To make integrating with the Sharespine API as easy as possible you can create a Postman collection that you can populate with your own application credentials and environment variables. You create the collection from the most recent API definition so it will always be up to date.

Create collection

Creating the collection this way involves a few steps but bare with us, it will be worth it in the end.

  1. Get the swagger file from here and save it.
  2. Open Postman and click on File - Import
  3. Select the file you saved
  4. TIP: Click Show advanced setting and enable the setting Disable optional parameters to get more clean requests
  5. A new collection is now created
  6. Click Collections, select the new collection and click ... to edit the collection
  7. Choose the Authorization tab and set type to Basic Auth
  8. Enter {{username}} and {{password}} in the Username and Password fields. These are variables that will be used for all endpoints in this collection
  9. Go to the tab Pre-request Scripts and paste the following code as is. This makes sure that the required authorization headers are set for each request.

pm.request.headers.add( { key: 'X-Tenant', value: pm.environment.get("tenant") } ) pm.request.headers.add( { key: 'X-ConnectionId', value: pm.environment.get("connectionId") } )

The settings for authorization and pre-request scripts should be done on the collection to apply the changes to all calls in the collection.

Create environment

Now we need to create an environment to hold the required variables. Create a new environment for each project or development environment to get a truly flexible setup.

  1. Click Environments in the left hand menu
  2. Click the plus (+) sign to create a new environment
  3. Create the following variables and fill them with the information you have received related to your project.
    • tenant
    • username
    • password
    • baseUrl
    • connectionId
  4. Make sure that the correct environment is chosen in the right hand corner before the first request is sent. If no environment is selected No environment is shown.
  5. You are now ready to test your first API call!

External resources