# API Components

The following are the components that are required in making successful API Calls to a system:

* [Request Methods](#request-methods)
* [URL](#relative-url-endpoint)
* [Params](#params)
* [Headers](#headers)
* [Body](#request-body)

### Params, Headers, Body Structure

Three fields are set for each parameter/header/body:

<table data-header-hidden><thead><tr><th width="143.5">Field</th><th width="296">Description</th><th>Example</th></tr></thead><tbody><tr><td>Field</td><td>Description</td><td>Example</td></tr><tr><td>Label</td><td>A suitable display name for headers/params/body data</td><td>Content-Type</td></tr><tr><td>Key</td><td>Variable name at which the value is populated</td><td>Content-Type</td></tr><tr><td>Value</td><td>The actual value stored in the Key</td><td>application/json</td></tr></tbody></table>

> The above values can be bulk edited in the format: `label::key::value`
>
> `Content-Type::Content-Type::application/json`
>
> `Accept::Accept::application/json`

{% hint style="info" %}
[`GET_FROM_CREDENTIALS`](https://docs.dckapintegrator.com/project-manager/systems/api-manager/pages/62jdAYSR9SyVr6SQOvXC#2.-get_from_credentials) and [`DYNAMIC_TOKEN`](https://docs.dckapintegrator.com/project-manager/systems/api-manager/pages/62jdAYSR9SyVr6SQOvXC#1.-dynamic_token) keywords can be used in API Manager params, header and body values, just like in the systems [test connection](/project-manager/systems/private-systems.md#test-connection) section.
{% endhint %}

### Request Methods

Request Methods specify the action to be performed by an API call, on a resource. Choose from the drop-down list.

![](/files/-LwNo6Qpq0oq0oQ4U45j)

For more information on Request methods click [here](https://developer.mozilla.org/en-US/docs/Glossary/Request_header).

### Relative URL / Endpoint:

The endpoint is the location or touch-point of communication, from which the API can access resources to carry out its functions.

Let's say you want to invoke an API call using a URL such as `http://www.example.com/api/customers`.

Here, the host-name `www.example.com` is provided in the credentials section in the Projects Area. So only the relative URL `/api/customers` needs to be provided here.

Some examples are

```http
<GET> /api/customers/{customer_id}

<POST> /api/customers

<PUT> /api/customers/{shipping_id}/editshipping
```

In an API call, URL arguments and query parameters can also be sent. These are defined in the 'API Call' handler in Flows.

**Use Case - URL Arguments**

Let’s say, you want to make an API call with dynamic values in the URL like `http://www.example.com/api/customers/2`. Here, `2` is the dynamic value. This can be achieved by replacing the dynamic value with a unique variable name and this value will be provided in Flows during run-time.

The Endpoint provided in the API Manager will be: `/api/customers/{customer_id}`

In order to assign the dynamic value, enter `{"customer_id":"2"}` in API Call Handler in the URL Arguments box. The Endpoint will then replace the URL argument as: `/api/customers/2`, which indicates that information from `customer_id = 2` is accessed.

### **Params**

Query parameters are also assigned in the API Call handler in Flows. Let’s say, you want to make an API call with query params in the URL like `/api/customers/?format=json`

The Endpoint provided in the API Manager will be:  `/api/customers` and the query parameter defined in the API Call handler is `{"format":"json"}`.

The Endpoint will then include the query parameter.

![Setting URL arguments and params in the API Call Handler](/files/-LwNo6QqsYtXR3Msf82q)

### Headers

Header data are passed as part of an API call.

![](/files/-LwNo6QrSHA-vrOoAHle)

Commonly used Header data include:

1. Content-Type
2. Accept

For more information on Headers please click [here](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers).

### Request Body

JSON objects that are sent along with a POST or PUT request, to create/ update a resource. Body parameters are dynamic data, usually assigned in the Payload section of the API Call handler in Flows.

![Setting Body data in the API Call Handler](/files/-LwNo6Qs0DjFGabpgw6F)

##


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.dckapintegrator.com/project-manager/systems/api-manager/api-components.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
