After you have successfully authenticated your application, you can send a request to the MYP API using an access token.
Send API request
The following table shows the header and body fields that can be included when sending a request for a specific endpoint:
|The media type of the resource.
||The access token that has been acquired from MYP authentication server.
||Version of the MYP API (can be specified here or as a parameter).
||Version of the MYP API (can be specified here or in the headers).
||Additional OData query.
||Fields and their values for sending a POST or PUT request.
Sending a POST, PUT or DELETE request is similar to sending a GET request. However, fields and their associated body values must be specified when making a call. For more information on which fields are required to be sent when updating or creating a new entity, refer to a specific endpoint in the side navigation.
When making a call to the MYP API, an API version must be specified either in the headers or as a parameter. The name of the custom header for the API version is ‘x-mypapi-version’. The name of the parameter for the API version is ‘version’.
The MYP API version numbering adheres to the following scheme:
- major – this version represents changes that are not backwards compatible, such as deleting or changing a field
- minor – this version represents changes that are backwards compatible, such as adding a new field
When calling an MYP API endpoint, the response contains headers with the supported and deprecated versions.
Filter using OData
The MYP API uses the .NET OData library, allowing responses to be filtered.
When requesting a full list of a particular entity, the API response will include a list of 300 entities and a link to get the next 300 entities. Below is an example of a GET request for a list of all clients:
The following table outlines keys that can be sent to filter the response using OData:
||Only return a maximum of 1 entities.
||Return a response with only the ClientGuid and BusinessName fields.
||Return a response with all nested fields included.
||Country eq Australia
||Filter for records where country field equals to Australia.
||Skip the first 300 entities.
||If this parameter included and value is true, the response will show the number of entities there are for the specified endpoint.
For improved performance, it is recommended that you only construct a query that requests the fields and number of entities that are required. For example ‘$select=ClientGuid,BusinessName&$top=1’.
Further reading on OData
For more information OData:
Filter by id
To get a response that includes more details about an entity, specify the id of the entity in the URL. Below is an example of a GET request for a detailed entity:
Responses from the MYP API are returned with standard HTTP response codes. The following table provides examples of the different response codes that you may receive when calling the API:
||An API request returned successfully (usually a sucessful GET return).
||A POST method executed successfully.
||An UPDATE method executed successfully.
||The resource has been found but has been temporarily moved to a different URI. Clients will typically get this message when they are redirected to another URI during the login process.
||The API does not recognise the request. Ensure that the headers are set correctly.
||The request was not authenticated. Ensure that you have set up your authentication tokens correctly.
||The requested item is not allowed.
||Item not found
||The requested item was not found. Ensure that the correct id was entered.
||Internal server error
||There is an error with the MYP API server. Try again.
For further information about the standard HTTP response codes, refer to the official Mozilla website: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status