Method is an action, which is performed when API Request is sent to the server. To create one do the following steps:
Navigate to API Providers (RED MARK) section on the Top Menu of Mobsted platform
Select the API provider (RED MARK), for which you want to create API method
In the pop up opened go to the API Provider Methods tab (RED MARK)
Click Create new API Provider Method (ORANGE MARK)
Fill in the following fields (RED MARK):
- Api Provider Method Name
- Method - select one of the available HTTP request methods (GET, POST, PUT, DELETE)
- Endpoint URL
- Consumes Type - select the data type used when sending the API request
- Produces Type - select the response type to the request sent by the API
- Parameters - create the required and optional parameters for your API method
Most API queries must contain a number of parameters.
To create a parameter, click the Add Parameter button. (RED MARK)
In the pop up opened fill in the following fields :
- Name - Parameter name according to the documentation of the third-party service provider
- In - select in which part of the API request this parameter should be used (query, header, path, formData, body)
- Type - select parameter data type (string, number, integer, boolean)
- Description - add the parameter description so that your colleagues can understand what data you need to specify
- Required - check the checkbox if you want the parameter to be mandatory
Click Save Parameter. If the API method should contain several parameters, then repeat the above steps.
Click Save API Provider Method
Click Close to return to API Provider settings.
Optional step
To use the API method's response in your Mobile App ( Data references in app ) you can add one or several responses.
Let's see an one example
Your API method provide these responses:
Click Add New Response
Fill in the following fields (RED MARK):
- Response name
- Response type
- Response text
Click Save
Now this response and data in response text will be available in your Mobile App