update many custom org feilds via API suceeding but not updating data in sandbox
Hi,
We added two new custom org fields and have tens of thousands of records to update. I don't want to do them 1999 at a time using the bulk update functionality, so I was trying to test an update many through the API. The below block succeed, but I did not see either field update in our sandbox. I also tried making the list of updates a value for custom fields in a dictionary as a value for the organizations dictionary, but received a parameter error. Do I have this structured properly? Am I calling the custom field names incorrectly? Am I doing something dumb, like the Ids should be strings? The API documentation isn't really helping at this point.
curl --location --request PUT '
https://company_sandbox.zendesk.com/api/v2/organizations/update_many.json
' \
--header 'Authorization: {AUTH}
--header 'Content-Type: application/json' \
--header 'Cookie: {Cookie}
--data-raw '{
"organizations": [
{"id":1500479850061, "sugar_system_id":"000-001", "sitename":"Data"},
{"id":1500479850141, "sugar_system_id":"000-002", "sitename":"Data"},
{"id":1500479850281, "sugar_system_id":"000-003", "sitename":"Data"}
]
}
'
-
Hi Chris! Since you're making a request to an endpoint that is going to create a job, as opposed to directly updating the record, you'll generally get a 200 if the payload is syntactically correct JSON. The reason that you're not seeing the update come through is because you need to pass in the fields in their own `organization_fields` object like this:
{
"organizations": [
{
"id": 1500479850061,
"organization_fields": {
"sugar_system_id": "000-001",
"sitename": "Data"
}
},
{
"id": 1500479850141,
"organization_fields": {
"sugar_system_id": "000-002",
"sitename": "Data"
}
},
{
"id": 1500479850281,
"organization_fields": {
"sugar_system_id": "000-003",
"sitename": "Data"
}
}
]
}Let us know if you run into any issues!
-
Greg Katechis Your example does not match the example in the documentation. Can you make sure the docs reflect the correct JSON structure?
https://developer.zendesk.com/api-reference/ticketing/organizations/organizations/#batch-update
-
Hey, David Gordon!
The example in the documentation provides the id and notes properties which are an integer and a string, respectively. The code sample is only intended as a basic demonstration of the format. You can take a look at the JSON format table for a description of each property available to the organizations object, including the data type.I hope this helps!
Tipene
-
Hi Tipene Hughes,
Sorry, this does not help. The example in your documentation is incorrect, and should be fixed to provide an example that will work for folks like me, who are interested in using this particular API. I don't understand your comment, and the formats are entirely different. It's not like the example that Greg Katechis provided at all. Apologies, but I have had some other recent frustrations with the API and I can't accept that the docs will continue to be incorrect when such a glaring discrepancy is raised.
Regards, Dave
-
No worries at all! Just to make sure we’re on the same page, are you referring to the example provided under the Batch update section of the Organizations endpoint documentation?
Please sign in to leave a comment.
5 Comments