A highly scalable API for end-users to access Motto resources
GET
and POST
requests, and will return standard JSON.
The primary difference with REST is that the API routes look a little different than you may be used to.
GET
requests for read-only operations, please follow along with a basic example.
Let’s say we want to get a list of all events in the project, you would send a GET
request to the following URL:
https://cda.mottostreaming.com/motto.cda.cms.event.v1.EventService/ListEvents?encoding=json&message=%7B%22pageSize%22%3A%2225%22%7D
This URL is broken down as follows:
https://cda.mottostreaming.com
-> This is the base URL of the API. Should look familiar, so far!motto.cda.cms.event.v1.EventService
-> This is the “package” and “service” of the API. It tells Motto servers which part of the API you are trying to access. You can find all available packages here.ListEvents
-> This is the “method” of the API. It tells the API which specific operation you are trying to perform. You can find all available methods on page linked in step (2), after selecting a package.?encoding=json&message=%7B%22pageSize%22%3A%2225%22%7D
-> This is the query string of the API. It tells the API which parameters you are trying to pass to the method. In this case, we are passing a JSON object with a pageSize
of 25, since that’s what this example endpoint requires. Please note that the JSON should always be URL-encoded, and should be included in the message
parameter (you should not change the encoding
parameter)!
To know which parameters are needed for each method, you can click into a method’s Request
, e.g. for list events.curl
:
Authorization
header, please see the authentication section.
You now know how to perform GET
requests to the Content Delivery API. However, some operations require POST
requests, which we will cover in the next section.
POST
requests for write operations, please follow along with a basic example.
Let’s say we want to obtain a Motto JWT for a user that has signed in using Userfront (a third party user management service).
From the above section, we know how to navigate to the necessary API endpoint, which in this case can be found here.
As we can see in the documentation for this endpoint, this is not marked with NO_SIDE_EFFECTS
, which means it is not a cacheable request. Therefore, we need to use a POST
request. Such a request would look like this using curl
:
POST
requests, the parameters are no longer included in the URL, but in the body of the request. The body should always be a JSON object.
connect-protocol-version: 1
header, as this is required for all POST requests!