Send Requests

Use these guidelines when sending requests using the REST API for AI and ML services.

URL Structure

The URL structure for the requests is

apiRoot/resourcePath

where:

  • apiRoot is the URL for accessing the HTTP Gateway server at either http://hostname:Port or https://hostname:Port.

  • resourcePath is the path to the endpoint.

For example, the URL for fetching the data is:
http://hostname:port/data/fetch

where:

  • hostname is the host name for the application server.

  • port is the port for the application server.

Supported Methods

You can perform create and read operations on a resource using method requests. This table shows the supported methods.

HTTP Method Description
POST Create the resource.

Media Types

The REST API for AI and ML services supports the following media types:

  • application/json

Supported Headers

The REST API for AI and ML services supports the following headers that may be passed in the header section of the HTTP/HTTPS request or response:

Header Description Example
Content-Type

The media type of the body of the request. This is required for POST and PUT requests.

Content-Type: application/json

Authorization

The type of authorization. The REST API for AI and ML services uses the OAuth 2.0 bearer token framework.

Authorization:Bearer your_token

where your_token is your client application's OAuth 2.0 access token.

Accept

The media types that the client wants to receive in the response.

Accept: application/json

Host

The domain name (and optionally the port number) of the server to which the request is being sent.

Host: api.example.com

Swagger URL

If you use Swagger, you can make calls to the API for AI and ML services at this URL:

apiRoot/openapi/ui/index.html