Introduction
The SIRE 2.0 WebAPI is an API which allows SIRE 2.0 Integrators to interact with SIRE 2.0 Inspections, PIQs, the Certificate repository, and the Photo repository.
Documentation
Further API documentation is available at https://docs.ocimf.org/auth/sire-20-api/
Endpoints
These endpoints are visible to SIRE 2.0 integrators and can be viewed on:
Production: https://webapi.ocimf.org/guide/index
Integration: https://staging-webapi.ocimf.biz/guide/index
OAuth Tokens
Note: This document will use Postman for demonstration purposes.
Before using the WebAPI, you must first call the /token endpoint to get an OAuth token. To do this, create a new HTTP Request and enter the URL for the token endpoint.
This will be a POST request. In the Body tab, set the content type to x-www-form-urlencoded, then add three parameters:
• grant_type: “password”
• username: The user’s account number and username, separated by a | with no spaces
• password: The user’s password
Endpoint Testing
To call an API endpoint, enter the verb (GET, POST) and URL of the endpoint you want to call (as per the Swagger documentation), and add your access token to the Authorization tab of your request. You will also need to set the authorisation type to “Bearer Token”.
For example, if you have logged in as an Operator and you want to retrieve an inspection for one of your vessels, you can create the following request:
URL parameters such as “allowPurchase” in the example above can be added in the Params tab. For object parameters, you will need to add the name of both the object and the field. An example of this is in the inspection search method:
public async Task<IHttpActionResult> Search([FromUri] PaginationOptions p, [FromUri] InspectionSearchParametersModel s)
The pagination options for this method are mandatory, so you will need to add them to your query string. The parameter name is “p”, and the mandatory fields are “pageNumber” and “pageSize”, so the following formatting will need to be used (with the values changed as appropriate):
?p.pageNumber=1&p.pageSize=10
Alternatively, you can generate the appropriate query string by entering the parameters on the documentation page.
Comments
0 comments
Article is closed for comments.