Metadata File Configuration

This section explains the format of a Rest API metadata configuration file.

Structure

The metadata configuration file should conform to a particular schema, which comprises two main objects: "definitions" and "operations". The operations object describes the REST operation and the definitions object describes the input and output schemas referenced to these operations.

Example:

{
    "definitions": {
        ...
    },
    "operations": {
        ...
    }
}

Operations Object

The Operations Object describes the operations that would be displayed in the Operation dropdown under the Operation section of the Agents' configuration blade. This object contains one or more operations specified as key-value pairs (separated by comma), where the key is the name of the REST operation, which should be unique, and the value is an object that contains several properties that describe the REST operation, as explained below.

Example:

"operations": {
		"Get Current Weather": {
			"endPoint": "/current?access_key={AccessKey}&query={City}",
			"method": "GET",
			"description": "Get current weather by city",
			"parameters": [
				{
					"name": "AccessKey",
					"in": "path",
					"type": "string",
					"required": true
				},
				{
					"name": "City",
					"in": "path",
					"type": "string",
					"required": true
				}
			],
			"responseSchema": "Root"
		},
		"Get Location Details": {
			...
		}
	}

Parameters Object

The Parameters Object describes the input parameters that are required by the REST operation. This object is of type JSON array in which each item describes one parameter. The parameter will be displayed in the Input Mapping section of the Agents' configuration blade. Each parameter object has several properties, as explained below.

Example:

"parameters": [
	{
		"name": "AccessKey",
		"in": "path",
		"type": "string",
		"required": true
	},
	{
		"name": "City",
		"in": "path",
		"type": "string",
		"required": true
	}
]

Definitions Object

The Definitions Object describes the definition of schema referred to the Operations object's responseSchema property. This object contains one or more definitions specified as key-value pairs separated by commas, where the "key" is the name of the schema which must be unique and the "value" is an object that contains several properties that describe the schema, as explained below.

The value must conform to Newtonsoft JSON Schema specifications.

Example:

"definitions": {
		"Root": {
			"title": "Root",
			"type": "object",
			"properties": {
				"request": {
					"$id": "#root/request",
					"title": "Request",
					"type": "object",
					"properties": {
						"type": {
							"$id": "#root/request/type",
							"title": "Type",
							"type": "string",
							"default": "",
							"examples": [
								"City"
							],
							"pattern": "^.*$"
						},
						"query": {
							"$id": "#root/request/query",
							"title": "Query",
							"type": "string",
							"default": "",
							"examples": [
								"Sydney, Australia"
							],
							"pattern": "^.*$"
						},
						"language": {
							"$id": "#root/request/language",
							"title": "Language",
							"type": "string",
							"default": "",
							"examples": [
								"en"
							],
							"pattern": "^.*$"
						},
						"unit": {
							"$id": "#root/request/unit",
							"title": "Unit",
							"type": "string",
							"default": "",
							"examples": [
								"m"
							],
							"pattern": "^.*$"
						}
					}
				},
				"location": {
					"$id": "#root/location",
					"title": "Location",
					"type": "object",
					"properties": {
						...
					}
				},
				"current": {
					"$id": "#root/current",
					"title": "Current",
					"type": "object",
					"properties": {
						...
					}
				}
			}
		}
	}

Last updated