API Reference Overview
Documentation Overview
This API Reference documentation page provides details on how to use the DataMasque API.
If you're new to working with REST APIs, please read the Quickstart Examples section, which provide an overview of using Postman and curl
.
Otherwise, check the API Endpoints documentation to quickly access information about each endpoint and their curl
examples.
Quickstart Examples
The examples on this page use
<
and>
as delimiters for example values, but these characters should not be used in the requests.
Preface
These examples are made for beginners new to using REST APIs.
We'll guide you step by step on how to use Postman and curl
to interact with the DataMasque API.
Remember, the type of request (GET
, POST
, PUT
, etc.) depends on what is specified in our documentation for each endpoint.
An Overview of Making Requests With Postman
Please note that this documentation is based on Postman version 10.22. Future or previous versions of Postman may have slightly different options or behaviors.
Aside from the Postman example listed in the Authentication section, this is the only Postman example. However, a
curl
example will be listed for each endpoint.
Open Postman: Launch the Postman application on your device.
Create a New Request:
- At the top of your window, select the File menu tab, then select New.
- At modal will appear which will ask what type of request is needed. Select HTTP.
Set the Request Method:
- Above the URL field, you'll see a dropdown menu. This is where you specify the type of request (
GET
,POST
,PUT
, etc.) as indicated in our documentation for the endpoint you are using.
- Above the URL field, you'll see a dropdown menu. This is where you specify the type of request (
Enter the URL:
- In the URL field, type
https://<your-datamasque-host>/<your-desired-endpoint>/
. - Replace
<your-datamasque-host>
and<your-desired-endpoint>
with the appropriate values provided in our documentation.
- In the URL field, type
Set Headers (For
POST
/PUT
Requests):- If the request type is
POST
orPUT
, you'll need to set some additional headers. - Go to the Headers tab just below the URL field.
- Add two keys:
Content-Type
andAccept
. For both, set the value toapplication/json
, unless specified as a different value in that endpoint's documentation.
- If the request type is
Add Request Body (For
POST
/PUT
Requests):
Sometimes a request body needs to be specified for sending special types of request parameters to the DataMasque API. One example of is this is during the API Token retrieval request. When makingPUT
orPOST
requests, check the endpoint's documentation listed on this page to see if a request body is needed.- Switch to the Body tab.
- Select
raw
and chooseJSON
from the dropdown menu that appears. - Enter the JSON-formatted data as specified in our documentation.
Authorization (If Required):
- Some requests might require an authorization token.
- In the Headers tab, add a new key
Authorization
. - Set its value to
Token <your-api-token>
, replacing<your-api-token>
with your actual token.
Send the Request:
- Click the Send button to dispatch your request.
Check the Response
- Under the Response section which takes up half of the My Workspace window in Postman, take a look at the returned response body under the Body tab.
- If the response body is empty, take a look at the Status header to the right of the response section.
- There should be a numerical code e.g.
200
followed by some text. If the text is notOK
and the status code is400
is higher, check the Body tab's returned JSON object to see if any error details have been specified. - If there are no error details returned in the response body, check if the status code next to the Status header is one listed in the Common Failure Responses of our API documentation. This details provided there should give more insight into what may have caused the error.
- If the status code is not listed there, refer to the endpoint's section of this documentation for any endpoint-specific error codes and their details.
An Overview of Making Requests With curl
Please note that this documentation is based on
curl
version 8.50.0. Future or previous versions ofcurl
may have slightly different options or behaviors.
Open Your Command Line Interface:
- Access your terminal on macOS or Linux, or your command prompt or PowerShell on Windows.
Construct Your Request:
- Start by typing
curl
. This is the basic command to use the curl tool. - Specify the request method by adding
-X
request followed by the method (POST
,PUT
, etc.) as indicated in our documentation for the endpoint you are using. (If the request method isGET
, you do not need to include the-X GET
flag as that is the default.)
- Start by typing
Enter the URL:
- After
-X <METHOD>
, type the full URL of the API endpoint you wish to call.
- After
Set Headers:
- For sending headers with your request, use the
-H
flag followed by the header in quotes. - For most requests, especially
POST
orPUT
, set theContent-Type
andAccept
headers toapplication/json
, unless specified as a different value in that endpoint's documentation.
- For sending headers with your request, use the
Add Request Body (For
POST
/PUT
Requests):- When the request type is
POST
orPUT
, and you need to send data, use the-d
option followed by the data in JSON format. - Ensure you've checked the endpoint's documentation to verify if a request body is needed.
- When the request type is
Include Authorization Token (If Required):
- If an endpoint requires an authorization token, add it to the headers using the
-H
flag. - For example,
-H "Authorization: Token <your-api-token>"
, replacing<your-api-token>
with the actual token you received from the token retrieval endpoint.
- If an endpoint requires an authorization token, add it to the headers using the
Send the Request:
- After constructing the full
curl
command with all the necessary flags and data, press Enter to send the request.
- After constructing the full
Check the Response:
- The response will be printed directly in the terminal. Review the response body and headers to ensure your request was successful.
Quickstart generic example with curl
curl -X <GET | POST | PUT | DELETE> "https://<your-datamasque-host>/<your-desired-endpoint>/" \
-H "Authorization: Token <your-api-token>" \
-H "<your-additional-headers>"
Common Responses
Upon making a request, as part of the HTTP response, you will receive a status code and potentially some details about the success status of the request made.
Most successful request response status codes will be in the range 200
to 299
.
For each endpoint detailed in this documentation, their expected success status codes and descriptions are listed.
However, when a response is not successful, there are several common failure response status codes which are useful to be aware of.
There may be several status codes which deviate from the ones mentioned in the following section, however, these will be listed in this documentation under specific endpoint sections.
Common Failure Responses
Status Code | Description |
---|---|
400 |
Bad Request: Check the JSON body and response for more information. |
401 |
Unauthorized: Token required. |
403 |
Forbidden: User is not allowed. |
404 |
Not Found. |