Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rachelpw/e9be5109fb1471a697c97705bd558e22 to your computer and use it in GitHub Desktop.
Save rachelpw/e9be5109fb1471a697c97705bd558e22 to your computer and use it in GitHub Desktop.
Download the request library by running 'node install request' and then in terminal run 'node [filename]' without quotes or brackets
Custom fields I am using:
"custom_field_definition_id":75128 is a date custom field
"custom_field_definition_id":75129 is a number custom field
"custom_field_definition_id":73665 is a drop down custom field
"custom_field_definition_id":75492 is a checkbox custom field
"custom_field_definition_id":75493 is a URL custom field
Regarding the custom date field, the date should be presented to the API as your local timezone.
We do not attach time zone information to the custom date field or do any kind of conversions.
It is just a date, no time, and whatever date you put in is what you will see.
CURL request to update a person record:
curl --request PUT \
--header "Content-Type: application/json" \
--header "X-PW-AccessToken:YOURTOKEN" \
--header "X-PW-Application: developer_api" \
--header "X-PW-UserEmail:YOUREMAIL" \
https://api.prosperworks.com/developer_api/v1/people/PERSONID \
--data '{"id":21268685,"custom_fields":[{"custom_field_definition_id":75128,"value":"10/11/2016"}, {"custom_field_definition_id":75129,"value":"300"},{"custom_field_definition_id":73665,"value":85245},{"custom_field_definition_id":75492,"value":true},
{"custom_field_definition_id":75493,"value":"facebook.com"}]}'
Create a lead with custom fields in node:
Steps:
Install node
Download the request library by running 'node install request'
Save the code below in a file and name it
Then in terminal run 'node [filename]' without quotes or brackets
Code:
var request = require('request');
var formData = {
"name": "Hodor9",
"email": {"email": "hodor9@hodor.com","category": "work"},
"phone_numbers":[{"number":"+19998887777","category":"mobile"}],
"tags": ["hodorhodor"],
"custom_fields":[
{"custom_field_definition_id":75128,"value":"11/30/2016"},
{"custom_field_definition_id":75129,"value":"200"},
{"custom_field_definition_id":73665,"value":85245},
{"custom_field_definition_id":75492,"value":false},
{"custom_field_definition_id":75493,"value":"facebook.com"}
]
}
var headers = {
"Content-Type": "application/json",
"X-PW-AccessToken" : "YOURTOKEN",
"X-PW-Application" : "developer_api",
"X-PW-UserEmail" : "YOUREMAIL",
};
var opts = {
url: 'https://api.prosperworks.com/developer_api/v1/leads',
method: "post",
headers: headers,
json: true,
body: formData
};
request.post(opts);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment