Implementing API requests

Introduction

Having added a Patchworks service for your Inbound API connector, you can implement your own API requests to send required data to the Patchworks endpoint for that service. This page summarises the information that you will need to accomplish this task.

Prerequisites

To implement API requests for sending data to a Patchworks service, you must have completed the following tasks in Patchworks:

API implementation requirements

To implement API requests for sending custom data to a Patchworks service, you will need:

Token endpoint & OAuth credentials

You must provide a valid access token to POST custom data to a Patchworks service. To obtain access tokens, send a GET request to the Patchworks token endpoint, with your OAuth client credentials.

Access tokens are valid for 24 hours - for example:

Issued: Wednesday 20th July at 10:03:08 GMT Expires: Tuesday 21st July at 10:03:08 GMT

You can generate OAuth client credentials and view the required token endpoint from the authentication tab for your Inbound API connector. For details, please see: Generating token credentials for API access.

Suggested Best Practice

To minimise the chance of any issues with rate limits, we advise obtaining an access token once a day and storing this for use in any requests (rather than requesting an access token every time you want to post data).

If you attempt to post data with an expired access token, Patchworks returns a 401 status code, which should be your trigger to request a new token.

Patchworks service endpoint URL

To POST custom payload data to a Patchworks service, you need the URL for that service. Service URLs are always in the form:

https://inbound.pwks.co/v1/[YOUR COMPANY NAME]/[VANITY URL]…where:

  • [YOUR COMPANY NAME] is auto-generated by Patchworks, based on the company name provided for implementation.

  • [VANITY URL] is your preferred text value to complete the URL.

Last updated