Articles in this section

Test a JavaScript API

Send a test request to your JavaScript API to confirm that the script runs and returns what you expect, before an external application starts calling it. This article is for account owners and administrators who have already built a JavaScript API. It uses Postman, but any tool that can send an HTTP request works the same way.

Prerequisites: Build a JavaScript API so you have the endpoint URI and an API token scoped to the JavaScript API.

Send a test request

  1. Go to Resources , and then select APIs.
  2. Select the JavaScript tab, and then select your JavaScript API.
  3. Select Copy URL.
  4. In Postman, create a request, set the method to POST, and paste the URL into the request URL.
  5. Open the Authorization tab, select Bearer Token as the Type, and paste your API token into the Token field.
  6. Open the Headers tab and set Content-Type to application/json.
  7. If your script reads data from the request, open the Body tab, select raw and JSON, and enter the data your script expects.
  8. Select Send.

A 200 status code means the script ran. The response body contains what your script returned. If the API token is lost, create another one, because a token value appears only once.

Test a ShipWorks request

A JavaScript API with ShipWorks authentication checks a username and password instead of a token, so you don't send a bearer token.

  1. Go to Resources , and then select APIs.
  2. Select the JavaScript tab, and then select your JavaScript API.
  3. Make sure Enable ShipWorks authentication is on and the Username and Password are entered, and then select Copy URL.
  4. In Postman, create a request, set the method to GET, and paste the URL into the request URL.
  5. Open the Body tab and select x-www-form-urlencoded.
  6. Enter key-value pairs for username, password, and body, using your ShipWorks credentials and the content your script expects.
  7. Select Send.