API Reference Page

The ItemPath API is based around REST (https://en.wikipedia.org/wiki/Representational_state_transfer).

In REST, there are up to 5 endpoints for every resource.

For example, here are the endpoints for materials:

  • GET /api/materials, a list of materials with optional get parameters
  • POST /api/materials, used to create a new material
  • GET /api/materials/:id, for accessing a singular material by id
  • POST /api/materials/:id, for updating a singular material by id
  • DELETE /api/materials/:id, for removing a material

These endpoints are standard across all REST API's.

What is an API?

An API in very simple terms is a way for one software program to exchange information with another source.

Send a Request. Get a Response.

We use APIs for everyday things like:

  • Checking the weather forecast.
  • Buying something from Amazon (where the supplier uses Amazon's API to list their
  • stuff).
  • Using our smartphone to set the temperature at home using our connected thermostat.
  • Checking airfares on a travel site.
  • Using an app to reserve a table at a restaurant or a seat at a movie theater..
  • Paying for things online.
  • Checking the sports scores

An API lets a developer make a specific “call” or “request” in order to send or receive information. It can also be used to make a defined action such as updating or deleting data.

There are four basic request methods that can be made with API:

  1. GET – Gather information (e.g. Pull all Materials in PPG -- with a filter applied)
  2. PUT – Update pieces of data (e.g. Update a Material in PPG)
  3. POST – Create a new record (e.g. Add an Order Line to PPG)
  4. DELETE –Delete a record (e.g. Remove an Order Line from PPG)

What is required?

Hosted:

  • A connection string to the PPG database, and an open (secure) port)
  • See Requirements (Hosted) for more details

On-Premise:

  • A server (preferably Linux) to host the application. We recommend a secure connection for us to monitor the system.
  • For more details, see

What PPG components are required for the ItemPath API?

  • ItemPath requires 1 PPG "Web Services" module which enables 1 login for the API to access the program.
  • In some more involved cases, additional Web Services licenses may be required.
  • Other PPG modules selected should reflect what the customer needs PPG to do (e.g. Order Processing)

This API provides a bridge and a REST interface for the PPG databases and hardware. This information is collected from the PPG database, formatted, and exposed via a TCP IP connection.

Authentication

The API uses JWT tokens to authenticate users and API access. Before being able to access endpoints in the API, you'll need to have a username and password. The default user and password is available during the install process. Otherwise, you'll need to gain a username from a current authenticated user, either through the API, or the interface.

Logging in via the API

You can login using your credentials via /api/users/login. You will need to pass your username and password via the POST body:

POST /api/users/login

{
 "username": "Sample API",
 "password": "testing"
}

Once you've logged in, you'll receive 2 JWT tokens in the response (an access token and a refresh token). The access token will need to be passed in the header of every API request, looking like this:

Authorization: Bearer {JWT Access token}

If the username/password has been tagged as a software connection, you'll be able to upgrade your JWT access token to be non-expiring by using this endpoint. Be aware that you will need to pass in the refresh token for this endpoint instead:

GET /api/users/application-token