---
title: Postman Tutorial
slug: postman-tutorial
docTags: 
createdAt: 2023-03-22T17:06:39.000Z
---

This tutorial will guide you through the installation of Postman API analyzer and how to test your Signed mTLS Certificate files and your API Keys.

We recommend that developers use our sandbox environment for IT tests, integration tests and initial data push/pull tests.

# Configure Postman

## 1: Install Postman

To get started, download the Postman app: [https://www.postman.com/downloads/](https://www.postman.com/downloads/)

::Image[]{src="https://files.readme.io/36e58b7-download_postman.png" size="50" isUploading="false" showCaption="false"}

Click the download button to install the Postman App, then follow the instructions to configure Postman on your machine

Once it is installed, continue to the next tutorial to configure mTLS

:::hint{type="warning"}
**Please Note:**

The download button will show the required version you need for your specific operating system.
:::



## 2: Configure mTLS Certificate in Postman

Go to the Gear Icon and click 'Settings' in Postman

::Image[]{src="https://files.readme.io/675de0b-postman_settings.png" size="50" isUploading="false" showCaption="false"}

Click on the 'Certificates' tab and then 'Add Certificate'

::Image[]{src="https://files.readme.io/176851c-add_certificate.png" size="50" isUploading="false" showCaption="false"}

Enter the following information:&#x20;

- Host - Enter the host for the environment you would like to access
- CRT File - This is your xecta-data-api.pem
- KEY File - This is your xecta-data-api.key

:::hint{type="warning"}
Your signed certificate (PEM and KEY) is generated as part of the [mTLS & API Key Creation](docId\:HRo4LnNgI79gn1Ww2Y-Ma) tutorial
:::

:::hint{type="info"}
For the tutorial screens below, use the following REST URLs for the host baseURL:

Stage Environment: **data-stage.onxecta.com**

Production Environment: **data.onxecta.com**
:::



::Image[]{src="https://files.readme.io/10e8d77-add_certificate.png" size="50" isUploading="false" showCaption="false"}

Last step is to click the 'Add' button

## 3: Import Project in Postman

Download the OAS file to import into Postman here: [Production OAS File](https://github.com/XectaDigitalLabs/Platform.Data.Client/blob/main/production-openApiASpecification.json)

Once you download the OAS file, import the project into Postman. To do this:

1. Click on the APIs Tab
2. Click 'Create an API'

::Image[]{src="https://files.readme.io/203d6fd-click_apis_tab.png" size="50" isUploading="false" showCaption="false"}

1. Click the Import Button
2. Select the file which you had downloaded from the GitHub repo listed above
3. Click the Import Button to finalize the import

::Image[]{src="https://files.readme.io/4b78099-import_oas.png" size="50" isUploading="false" showCaption="false"}

::Image[]{src="https://files.readme.io/f9de778-finalize_import.png" size="50" isUploading="false" showCaption="false"}

Now you should see the project imported into Postman and you can begin looking at the endpoints

::Image[]{src="https://files.readme.io/247424c-Import_complete.png" size="50" isUploading="false" showCaption="false"}

***

# Testing API Credentials

## 1: Setup Basic Auth

To begin, start a new empty POST request with the URL: [https://prod.authenticate.onxecta.com/oauth2/token?grant\_type=client\_credentials](https://prod.authenticate.onxecta.com/oauth2/token?grant_type=client_credentials)

Verify in the Params tab that there is a KEY entry for grant\_type with a value of client\_credentials

::Image[]{src="https://files.readme.io/dee98de-client_credentials.png" size="50" isUploading="false" showCaption="false"}

Next, click the Authorization tab and select Basic Auth

::Image[]{src="https://files.readme.io/33cca83-basic_auth.png" size="50" isUploading="false" showCaption="false"}

Here you will input your Client ID for the Username, and Client Secret as the password. These were provided to you via SendSafely

::Image[]{src="https://files.readme.io/3301d89-user_creds.png" size="50" isUploading="false" showCaption="false"}

:::hint{type="danger"}
The above Username is a fake generated Username for instruction purposes only. It does not tie to any App Client in AWS Cognito
:::

## 2: Setup Headers

Next, navigate to the Headers tab. You will need to add a Content-Type Header with the value application/x-www-form-urlencoded as shown below

::Image[]{src="https://files.readme.io/eb6d247-header.png" size="50" isUploading="false" showCaption="false"}

## 3: Get the Access Token

Now you are all set up! Click the Send button and you will get an access token returned if everything was set up correctly. It will look similar to this below

![](https://files.readme.io/a0332de-bearer_token_2.png)

## 4: Test the Xecta API

The final step is to run a query against the Xecta API.

Copy the Access token from the step above and open an API endpoint from the left side, which was imported into Postman previously

Set the URL to point to the Production Environment:
[https://data.onxecta.com](https://data.onxecta.com/)

![](https://files.readme.io/6c6f105-api_endpoints.png)

Navigate to the Authorization tab, and select the Bearer Token Type from the drop down

![](https://files.readme.io/2ead4cf-bearer_token_auth.png)

Paste your previously generated Access token into the Token field here

![](https://files.readme.io/5fb0f14-token_input.png)

Click Send, you should get a 200 OK response

You are now fully connected to the Xecta API!

***

# Testing API Requests

The following sections provide specific examples to accomplish various tasks with the API endpoints.

## API GET Request

GET requests retrieve data already imported into the system

### 1: Fetch Multiple Wells

Uncheck Query Params of "offset" and "limit"

![](https://files.readme.io/5c0fa0a-image.png)

### 2: Fetch Single Well

Insert value for Path Variable - uwi

- Example: uwi: enim
- Empty results with 200 OK response will be returned if queried uwi doesn't exist in database

![](https://files.readme.io/17acf18-image.png)

### 3. Fetch Daily Production Records

Insert value for Path Variable - uwi

- Example: uwi: enim
- Empty results with 200 OK response will be returned if queried uwi doesn't exist in database

![](https://files.readme.io/398a17a-image.png)

## API POST Request

POST requests allow you to submit data for import

### 1: Bulk Add/ Update Well Data

In Body, specify data to be added to the Well

![](https://files.readme.io/fd68a41-image.png)

![](https://files.readme.io/7f02e8e-image.png)

200 OK response returned when data has been successfully added/ updated to Well

### 2: Bulk Add / Update Daily Production Data

In Body, specify data to be added to the Daily Production

- uwi of new data has to exist in Well, otherwise 400 Bad Request response will be returned

![](https://files.readme.io/8ebbd15-image.png)

## API DELETE Request

Delete requests allow you to remove data previously imported into the system

### 1: Delete Single Well

![](https://files.readme.io/e09b94d-image.png)

Insert value for uwi. 200 OK returned if data has been deleted successfully; 400 Bad Request returned if uwi doesn't exist in database.

### 2: Delete Daily Production Record

Insert value for xid. 200 OK returned if data has been deleted successfully; 400 Bad Request returned if xid doesn't exist in database.
