Skip to main content

API Configuration

API providers can publish and manage multiple APIs on myAPIz.

For each API, we maintain a configuration YAML file named as {api-id}.yaml

The YAML file must comply with the following schema definition.

Configuration Reference

id: # Required. Unique ID for this API. This technical reference to your API will appear in URLs, documentations, and other resources.
name: # Required. Unique, human readable, short name to be used in API directory, reports, etc.
description: # Required. A single paragraph description of the API, USP statement, or similar.
baseUrls:
- # Required. Base urls of the published API.
schemaUrl: # Required. Publically accessible URL to the Openapi schema definition of the API.
security:
type: key # only key based authentication is supported right now
headers: # Recommended. List the headers myAPIz should send you for each request
- name: # Required. Header name you expect to look for in your API for request validation or client identification. Must be unique header name. Recommended way to make it unique is to prefix it with your ID as defined above: e.g. "x-<your-api-id>-<property-name>"
value: # Required. String or Golang template to be provided as header value in the requests. See the reference below.
provider:
maintainer: # Required. Email of the main contact person responsible for the API.

Header Template Reference

The header value is a Golang template that is rendered for each request. It is a flexible way to provide API specific dynamic headers defined by the provider.

API Provider has the full power and full responsibility when creating the template. It's provider's responsibility to create a valid header template.

Make sure the template is compliant with Golang template language.

Template properties

ApiProvides the API's ID defined in the configuration
OrgCaller's organisation ID
ClientCaller's Client ID. This is unique within an Organisation
PermsList of permissions (strings) assigned to the Caller. Those could be helpful when anthorizating a request.

Example:

id: sheet
name: Sheet
description: Publish your Sheet as API
baseUrls:
- https://api.example.com/v1
schemaUrl: https://api.example.com/schema/openapi.json
security:
type: key
headers:
- name: X-Myapiz-api
value: |
{{ .Api }}
- name: X-Sheet-Secret
value: Zhuyshw8764397649! # shared secret SheetAPI will expect and validate
- name: X-Sheet-user
value: | # the value below is a json string containing identity information. Sheet API will parse it and use it
# note the json filter converts the .Perms list into a json array
{"clientId":"{{.Client}}","orgId":"{{.Org}}","perms":{{ json .Perms }} }