Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Importing Collection into Postman

  1. Download Postman here

  2. Install Postman

  3. Using Postman, import the API collection above

    Image Modified

Setting up authorization

In order to send API calls using the API gateway, a system of BearerAuth, apiKey, and apiSecret are used. The steps below will guide you through obtaining the apiKey and apiSecret which will be necessary. Please keep in mind that the user you’re authenticating with will be the user executing the API calls. It is highly recommended you create an automation user within Sharpen which can persist through employee turnover.

...

Panel
bgColor#B3F5FF

By default, the base_url is set to https://api.iz1.sharpen.cx/v1. Please adjust this configuration if you’re using IZ0.

  1. Navigate to the ‘API Gateway Setup’ folder in Postman from your recently imported collection.

  2. Choose the ‘Variables’ tab.

  3. Check the box next to the appropriate "base_url" variable to correspond with the isolation zone in use.

    1. Only 1 may be checked.

    2. If you login to app.sharpencx.com, then use https://api.sharpen.cx/v1 as your base url.

    3. If you login to app.iz1.sharpen.cx, then use https://api.iz1.sharpen.cx/v1 as your base url.

      Image Modified
  4. Click “Save” at the top right.

Gathering your JWT(Json Web Token)

Create Authorization API call method

  1. Navigate to the ‘Create New Authentication’ API call under the ‘Authorization setup' folder

  2. Identify the ‘Authorization’ tab once selecting the api from the folder list

  3. Choose ‘Basic Auth’ from the drop down

  4. Enter the credentials of the Sharpen account corresponding with the account you’re interfacing with

  5. Click ‘Send’

  6. Response should look like

    Image Modified

Login to App method (alternative to the method above)

Expand
titleProcess
  1. Identify Sharpen account you will be executing the API call against

  2. Login to that account via app.sharpencx.com or app.iz1.sharpen.cx

  3. After logging in, right-click in an empty space on the page, and choose ‘Inspect’

  4. Navigate to the ‘Application’ tab

  5. Under ‘Storage’ on the left side, expand ‘Session Storage’

  6. Identify ‘apiAuthToken’

  7. The string in the ‘Value’ field is your token

Gathering apiKey and apiSecret

  1. Navigate to the ‘Create API Key’ api call under the ‘Authorization Setup’ folder within the imported Postman collection.

  2. Click the ‘Authorization’ tab and make sure ‘Bearer Token’ is chosen.

    Image Modified
  3. Insert the token gathered in step 6 of “Gathering your JWT” here

  4. Navigate to the ‘Body’ tab

  5. If you want an expiration on the token, update the date/time to the proper expiration time. If you do not want an expiration, modify the body to

...

  1. reflect.

Status
titleUnknown Attachment

  1. Image AddedImage Added
  2. Click ‘Send’

  3. The return should look like this

    Image Modified
Panel
bgColor#DEEBFF

The language of the response needs translation to what is expected later in the flow

clientId = api-key
clientSecret = api-secret

...

The examples below are some of many API calls which can be run. These . In particular, the examples below deal with the SharpenDB functionality within the API Gateway. They show how to create a table, column(s), and query SharpenDB from the API Gateway. Please refer to the API Gateway docs to see all available API calls.

Create Table

  1. Identify the ‘Create Table’ request under the ‘SharpenDB2->Tables’ folder in the Postman collection

  2. Under the ‘Headers’ tab update the x-api-key and x-api-secret values to match that of the values you retrieved in “Gathering apiKey and apiSecret” above.

    Image Modified
  3. Under the ‘Body’ tab enter your query in JSON format

    Code Block
    languagejson
    [
      {
        "name": "TableName"
      }
    ]
  4. Click ‘Send’

  5. The request and response should look something like this…

    Image Modified

Create Column

  1. Identify the ‘SharpenDB2 Create Column’ request under the ‘SharpenDB2->Columns’ folder in the Postman collection.

  2. Under the ‘Headers’ tab update the x-api-key and x-api-secret values to match that of the values you retrieved in “Gathering apiKey and apiSecret” above.

  3. Under the ‘Body’ tab enter your query in JSON format

    Code Block
    languagejson
    [
      {
        "field": "columnName",
        "type": "varchar(255)",
        "nullable": true,
        "default": "string"
      }
    ]
  4. Click ‘Send’

  5. The request and response should look something like this…

    Image Modified

Query

The Query SharpenDB api allows for your standard SQL operations to be committed to a structured table. This includes SELECT, INSERT, UPDATE, and DELETE.

  1. Identify the ‘SharpenDB2 Select’ request under the ‘SharpenDB2->Queries’ folder in the Postman collection

  2. Under the ‘Headers’ tab update the x-api-key and x-api-secret values to match that of the values you retrieved in “Gathering apiKey and apiSecret” above.

    Image Modified
  3. Under the ‘Body’ tab enter your query in JSON format

    Code Block
    languagejson
    {
    "type": "select",
      "condition": 
        {
          "columnName": {
            "$eq": "value"
          }
        }
    }
  4. Click ‘Send’

  5. The request and response should look something like this…

    Image Modified

Anchor
Examples
Examples
QUERY Examples

...