NAV
shell

Introduction

Welcome to the In a Pinch API! You can use our API to access In a Pinch API endpoints, which can get information on loaders and current usage within your project.

Authentication

To authorize, use this code: Make sure to replace token with your API key.

# With shell, you can just pass the correct header with each request
curl "https://api.inapinch.io/v1/api" \
  -H "Authorization: token"

The above command returns JSON structured like this:

{
  "apiId":"e2339719-75d6-4983-9785-41aac54bc778",
  "projectId":"e2a99d6b-90fc-4d72-9303-a58a7af393dd",
  "ownerId":"3c118249-6ac8-4ce0-a2ee-f7274ef8da70",
  "now":"2022-07-13T21:34:12.141Z"
}

In a Pinch uses API keys to allow access to the API. All API Keys are project specific; you can create a new api key in your project settings, see this blog post for more information.

In a Pinch expects for the API key to be included in all API requests to the server in a header that looks like the following:

Authorization: token

Loaders

Get All Loaders

curl "https://api.inapinch.io/v1/loaders" \
-H "Authorization: token"

The above command returns JSON structured like this:

[
  {
    "name": "Complex Query",
    "id": "39125626-67b3-43c7-af52-03a7529885c7",
    "createdAt": "2022-07-11T22:16:01.331Z"
  },
  {
    "name": "Summer Recipes",
    "id": "ab6e5772-4714-4b1f-96d1-6cae1d286b7b",
    "createdAt": "2022-07-11T23:47:58.428Z"
  },
  {
    "name": "CMS Content",
    "id": "fabaf4e4-07ac-4f21-a963-39149bfa7691",
    "createdAt": "2022-07-11T23:55:30.227Z"
  }
]

This endpoint retrieves all Loaders.

HTTP Request

GET https://api.inapinch.io/v1/loaders

Get a Loader

curl "https://api.inapinch.io/v1/loaders/2" \
  -H "Authorization: token"

The above command returns JSON structured like this:

{
  "id": "39125626-67b3-43c7-af52-03a7529885c7",
  "projectId": "0cf34f34-6b99-4ba5-a0c2-769c454b28ee",
  "createdBy": {
    "id": "ddd9afdc-7fd1-4940-9cde-6aa85c961676",
    "projectId": "0cf34f34-6b99-4ba5-a0c2-769c454b28ee",
    "type": 0
  },
  "createdAt": "2022-07-11T23:47:58.428Z",
  "name": "Todo Items",
  "isPublic": false,
  "definition": {
    "url": "https://jsonplaceholder.typicode.com/todos"
  }
}

This endpoint retrieves a specific loader.

HTTP Request

GET https://api.inapinch.io/v1/loaders/<ID>

URL Parameters

Parameter Description
ID The ID of the loader to retrieve

Invoke a Loader

curl --request GET \
  --url https://api.inapinch.io/v1/api/loaders/39125626-67b3-43c7-af52-03a7529885c7/invoke \
  --header 'Authorization: Bearer token'

The above command returns JSON structured like this:

[
  {
    "userId": 1,
    "id": 1,
    "title": "delectus aut autem",
    "completed": false
  },

  <...>

  {
    "userId": 10,
    "id": 199,
    "title": "numquam repellendus a magnam",
    "completed": true
  },
  {
    "userId": 10,
    "id": 200,
    "title": "ipsam aperiam voluptates qui",
    "completed": false
  }
]

This endpoint retrieves a specific loader.

HTTP Request

GET https://api.inapinch.io/v1/loaders/<ID>

URL Parameters

Parameter Description
ID The ID of the loader to retrieve

Update a Loader

curl --request PUT \
  --url https://api.inapinch.io/v1/api/loaders/39125626-67b3-43c7-af52-03a7529885c7 \
  --header 'Authorization: Bearer token' \
  --header 'Content-Type: application/json' \
  --data '{
    "name": "Collect Todo Items",
    "definition": {
        "url": "https://jsonplaceholder.typicode.com/todos"
    }
}'

The above command returns JSON structured like this:

{
  "id": "39125626-67b3-43c7-af52-03a7529885c7",
  "projectId": "0cf34f34-6b99-4ba5-a0c2-769c454b28ee",
  "createdBy": {
    "id": "ddd9afdc-7fd1-4940-9cde-6aa85c961676",
    "projectId": "0cf34f34-6b99-4ba5-a0c2-769c454b28ee",
    "type": 0
  },
  "createdAt": "2022-07-11T23:47:58.428Z",
  "name": "Todo Items",
  "isPublic": false,
  "definition": {
    "url": "https://jsonplaceholder.typicode.com/todos"
  }
}

This endpoint updates a specific loader.

HTTP Request

PUT https://api.inapinch.io/v1/loaders/<ID>

URL Parameters

Parameter Description
ID The ID of the loader to retrieve

Delete a Specific Loader

curl "https://api.inapinch.io/v1/loaders/2" \
  -X DELETE \
  -H "Authorization: token"

The above command has no content if successful

This endpoint deletes a specific loader.

HTTP Request

DELETE https://api.inapinch.io/v1/loaders/<ID>

URL Parameters

Parameter Description
ID The ID of the loader to delete

Metrics

Get All Metrics for this Project

curl "https://api.inapinch.io/v1/metrics" \
  -H "Authorization: token"

The above command returns JSON structured like this:

{
  "periodEnd": 1660191229000,
  "periodStart": 1657512829000,
  "version": "1.0",
  "calls": 146,
  "storage": 0
}

This endpoint retrieves all metrics for this project.

HTTP Request

GET https://api.inapinch.io/v1/metrics

Errors

The In a Pinch API uses the following error codes:

Error Code Meaning
400 Bad Request -- Your request is invalid.
401 Unauthorized -- Your API key is missing or incorrect.
403 Forbidden -- You don't have access to view this resource.
404 Not Found -- The specified resource could not be found.
429 Too Many Requests -- You're requesting too many resources! Slow down!
500 Internal Server Error -- We had a problem with our server. Try again later.
503 Service Unavailable -- We're temporarily offline for maintenance. Please try again later.