Language Independent API Access
Language Independent API Access demonstration:
Prerequisites
- Postman – Install Postman from https://www.getpostman.com/
- API Token – Generate and Save the API token. Refer Edit User.
- Application URL (InventoryCloud URL). You must use your own tenant name.
- List of APIs


- Request Format – JSON.
Note: POST APIs only support JSON input. Below shown is the sample JSON code.

Sending a POST Request
To send a POST Request, follow the steps below:
- Launch the Postman Application.
- Create New Screen will appear. Click on the Request- Create a basic request link. You can also click on the New button as shown below:

- Save Request Screen will appear.

- Enter the Request & Collection details.
- Enter the Request Name. For Example – InventoryInfoSearch.
- Enter the Request Description (optional).
- Search for Collection or Folder or Click on the +Create Collection or +Create Folder button to create new collection or folder.

- Click on the Save to API Public API button.
- My Workspace screen will appear. The screen will have a tab – InventoryInfoSearch (Request Name).

- Select the HTTP Method. Choose POST.

- Enter Request URL. The Request URL is the combination of your application URL and the API Name.

- Click on the Header tab provided in the My Workspace screen.

- Select the Key. Choose “Authorization”.

Warning! Due to increased security measures, the User-Agent record as shown above is mandatory.
- Enter the Value. Enter “Bearer”, insert a space, and then paste the copied token. The Response will not appear if the token is pasted without space. Refer to Edit User for downloading and copying the API token.

- Enter the Description (optional).
- Click on the Body tab provided in the My Workspace screen.
- Choose the “Raw” radio button.

- Choose “JSON" from the Content-Type drop-down menu. Once you select the content type, the Header tab will display the Content type (Key) as application/JSON (Value).
Note: Our APIs communicate using http standards with JSON formatted data for input and output. Other data formats are generally not supported.

- Enter the JSON Code. Example – Below shown is the sample JSON Code for POST public-api/locations/infosearch.

- Click on the Send button.

- The Response will appear under Body > Pretty. Click on the Save button. Example – The response will display all active locations whose location code or location description contains the specified texts entered in the code.

- On Saving, a message will appear indicating that the “Response is saved in examples and you can edit before saving. You can also add a new example with your custom response.”

- Status – 200 OK is a standard response for any successful HTTP request.

Note:
- If you use the Invalid token, the message "Could not get any response" will get displayed.

- Status - 403 Forbidden is returned if packet filter on our firewall blocked your Public API call for some reason. Reasons may include omitting the User-Agent header or including markup or other http tokens that the packet filter recognizes as a typical attack.

- Status – 415 Unsupported Media Type is returned if the user sets the Content-Type which is not supported by the application for example – Text, Javascript, HTML.

- Status – 422 Unprocessable Entity indicates that the server understands the content type of the request entity and the syntax of the request entity is correct but was unable to process the contained instructions.

- Status - 429 Too Many Requests is returned by the API if there is too much API traffic. You must slow down sending API request when you encounter this type of error. Examine the Wasp-OverloadProtection-Reset value in the response headers to determine the number of seconds you need to wait before sending the new request. Make sure to wait for the time displayed in the response header. If you send a request before the value has elapsed, your request will not get processed and a new retry value will be returned.

- Status – 500 Internal Server Error is returned when an unexpected condition is encountered. 500 Internal Server Error indicates that the something went wrong on the server side.
For Example - Error in JSON code. In this case, check if you used correct Json Object, Check the selected data format (as the APIs communicate only using http standards with json formatted data for input and output), check server logs to find out the error.

- The History tab will store all requests you sent using the POSTMAN application and Collection tab is a group of saved requests. Both History and Collection tab appears on the left-hand side of the Postman application.
