---
title: Pathfix payload
slug: pathfix-payload
docTags: 
createdAt: 2020-06-10T08:06:07.000Z
---

The Pathfix payload contains 4 different properties that enables Pathfix to package and send the data to the provider.&#x20;

The payload contains the endpoint url, method, payload and headers. The JS would look like this:&#x20;



```javascript

var pfxPayload = {
    "url":"PROVIDER_API_ENDPOINT",
    "method":"GET",
    "payload":{},
    "headers":{}
}

```



## pfxPayload

| Property | Description                                                                                                                                                                                                                                                                                                                                                                                       |
| -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| url      | *required*<br />URL to the endpoint as specified in the provider documentation. e.g. Google Calendar documentation to get a list of my calendars is defined [here](https://developers.google.com/calendar/v3/reference/calendarList/list)                                                                                                                                                         |
| method   | *optional*: Defaults to GET<br />HTTP Method in uppercase required by the provider. In the above example it is GET.<br />supported:<br />- GET<br />- POST<br />- DELETE<br />- PUT<br />- PATCH<br />- FORM<br />- MULTIFORM-POST<br />- MULTIFORM-PUT<br />- MULTIFORM-PATCH<br />- GETFILE<br /><br />[Method Reference details](https://docs.pathfix.com/pathfix-payload#5d-method-reference) |
| payload  | *optional*<br />Payload as required by your provider. In the case of Google Calendar it does not need any payload so it can be ommitted                                                                                                                                                                                                                                                           |
| headers  | *optional*<br />All standard headers like content-type etc. are all configured internally and sent across based on provider requirements. Add this only if additional headers are needed.  Look at [pfxPayload.headers](https://pfxPayload.headers)                                                                                                                                               |



## pfxPayload.headers

| Property       | Description                                                                                                                                        |
| -------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- |
| x-payload-type | Pathfix Header<br />Only needed when uploading files using Pathfix. The header tells Pathfix how to treat the payload.<br />supported:<br />- file |



## Method Reference

The methods supported by Pathfix are all of the standard HTTP methods and a few custom options. The custom methods do a simplification of the API calls by adding the necessary headers before the call is processed.

Custom methods are marked in Blue below:

| Method                                                | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| ----------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| GET                                                   | Standard HTTP specs apply                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| POST                                                  | Standard HTTP specs apply                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| DELETE                                                | Standard HTTP specs apply                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| PUT                                                   | Standard HTTP specs apply                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| PATCH                                                 | Standard HTTP specs apply                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| <font color="#3b9f0f">FORM</font>                     | This internally converts the method to POST and adds the `content-type: application/x-www-form-urlencoded` to the header.<br /><br />Additionally, all of the property values passed in the payload format are converted into url encoded name value string                                                                                                                                                                                                                                                                          |
| <font color="#3b9f0f">MULTIFORM-POST/PUT/PATCH</font> | This internally converts the method to POST/PUT/PATCH and adds the `content-type: multipart/form-data` to the header.<br /><br />Additionally, this accepts a specific format of JSON that includes the content definition and content itself and builds out a multipart payload to send to the given url.<br /><br />All requests bearing this method run asynchronously.<br /><br />It is important to note that the combined size of the request and response will have a direct impact on the number of call API units consumed. |
| <font color="#3b9f0f">GETFILE</font>                  | This internally makes a GET request but accepts a binary response and returns it to the calling app after converting it to a BASE64 format.<br /><br />It is important to note that the combined size of the request and response will have a direct impact on the number of call API units consumed.                                                                                                                                                                                                                                |



### Additional Method Payload Sample



**FORM Method&#x20;**

```none
//Stripe create customers example

{
    "url": "https://api.stripe.com/v1/customers",
    "method": "FORM",
    "payload": {
        "email": "jane.doe@example.com"
    }
}
```



**MULTIFORM Method**

```json
//Hubspot import contacts CSV example

{
    "url": "https://api.hubapi.com/crm/v3/imports",
    "method": "MULTIPART-FORM",
    "payload": {
        "content_part_0": {
            "name": "files",
            "contentType": "application/octet-stream",
            "fileName": "final_emails.csv",
            "content": "Rmlyc3QgTmFtZSxFbWFpbApEZW1vLGRlbW9AcGF0aGZpeC5jb20="
        },
        "content_part_1": {
            "name": "test_import",
            "files": [
                {
                    "fileName": "final_emails.csv",
                    "fileFormat": "CSV",
                    "fileImportPage": {
                        "hasHeader": true,
                        "columnMappings": [
                            {
                                "ignored": false,
                                "columnName": "First Name",
                                "idColumnType": null,
                                "propertyName": "firstname",
                                "foreignKeyType": null,
                                "columnObjectType": "CONTACT",
                                "associationIdentifierColumn": false
                            },
                            {
                                "ignored": false,
                                "columnName": "Email",
                                "idColumnType": "HUBSPOT_ALTERNATE_ID",
                                "propertyName": "email",
                                "foreignKeyType": null,
                                "columnObjectType": "CONTACT",
                                "associationIdentifierColumn": false
                            }
                        ]
                    }
                }
            ]
        }
    }
}

/*
--READ ME--
- Each child property under the payload represents a content part, e.g. content_part_0
- If "content" is sent then it is considered as a binary to base64 converted content
- If "content" is missing, then it the json within the content part is stringified and sent as a content
*/ 
```







