REST API Basics
Integrations REST API Training REST API

REST API Basics

REST stands for “Representational State Transfer”. Basically with a REST API call you are to get a piece of data (called a resource) when you link to a specific URL.

Each URL is called a request while the data sent back to you is called a response.

The Components of a REST API Request

A REST API request consist of 4 components: the url (the endpoint), the HTTP Verbs (the method), the headers and the data (or body).

The url consists of a root-endpoint and a path.

These are the root endpoints of the 4me service:

The path determines the resource you’re requesting for. For example, you will use the url https://api.4me.com/v1/changes to access the record type ‘changes’ in a 4me production environment outside Australia.

With the HTTP Verb you specify the type of request you send to the server. You can choose from the types below:

These methods provide meaning for the request you’re making. They are used to perform four possible actions: Create, Read, Update and Delete (CRUD).

The HTTP Headers

Each request to the 4me REST API must supply two headers to specify your personal access token and to specify the 4me account you need access to:

  1. Authorization: Bearer <personal-access-token>
  2. X-4me-Account: <accountID>

Access Rights – the Personal Access Token

With a personal access token you tell the 4me service who you are and based on your roles in 4me and on the access rights that have been specified in your personal access token, you will be able (or not …) to perform the actions on the resources as pecified in your REST API request. Read this topic on personal access tokens in the 4me GraphQL training to create and update a personal access token.

The Body

Finally the data (or body) contains information you want to be sent to the server. This option is only used with POST, PATCH or DELETE requests. These data is formatted in JSON (JavaScript Object Notation), a common format for sending and requesting data through a REST API.

4me REST API Documentation

You can find the complete 4me REST API library on the 4me Developer Website. Please read the general section of the API documentation before you continue with this training.

Next Topic