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 var pfxpayload = { "url" "provider api endpoint", "method" "get", "payload" {}, "headers" {} } 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 https //developers google com/calendar/v3/reference/calendarlist/list 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 https //docs pathfix com/pathfix payload#5d method reference 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 https //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 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 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 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 //stripe create customers example { "url" "https //api stripe com/v1/customers", "method" "form", "payload" { "email" "jane doe\@example com" } } multiform method //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 /