Introduction
The SIRE 2.0 WebAPI is an API which allows Submitting Members to interact with SIRE 2.0 Inspections.
Please note:
- Currently access to the Sire 2.0 API is only being made available to Submitting Members and not Vessel Operators.
- The following guide is intended for a software developer already familiar with Rest API development.
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 Endpoint Guide: https://webapi.ocimf.org/guide/index
Integration Endpoint Guide: 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:
Production Token Endpoint: https://webapi.ocimf.org/token
Integration Token Endpoint: https://staging-webapi.ocimf.biz/token
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” - The word 'password'
• username: "{{accountNumber}}|{{userName}}" - The user’s account number and username, separated by a "|" with no spaces.
• password: "{{userPassword}}" - 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, to retrieve an inspection you have already purchased, you can create the following request:
Production Base Url: https://webapi.ocimf.org
Staging Base Url: https://staging-webapi.ocimf.biz
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.