DEVELOPER CENTER
JavaScript

Pathfix payload

5min

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

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



JS




pfxPayload

Property

Description

url

required 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

method

optional: Defaults to GET HTTP Method in uppercase required by the provider. In the above example it is GET. supported: - GET - POST - DELETE - PUT - PATCH - FORM - MULTIFORM-POST - MULTIFORM-PUT - MULTIFORM-PATCH - GETFILE Method Reference details

payload

optional 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 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



pfxPayload.headers

Property

Description

x-payload-type

Pathfix Header Only needed when uploading files using Pathfix. The header tells Pathfix how to treat the payload. supported: - 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

FORM

This internally converts the method to POST and adds the content-type: application/x-www-form-urlencoded to the header. Additionally, all of the property values passed in the payload format are converted into url encoded name value string

MULTIFORM-POST/PUT/PATCH

This internally converts the method to POST/PUT/PATCH and adds the content-type: multipart/form-data to the header. 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. All requests bearing this method run asynchronously. 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.

GETFILE

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. 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

Text




MULTIFORM Method

JSON