I may have answered my own question on the Create & Update stuff...if you pass an "id" column where some rows have the ID specified and others don't, it will update the rows where the ID is specified and create rows where the ID is not specified.
It also looks like the updateBy Import option would allow me to specify alternative columns to control the update in the case where I don't have the "id" but do have other fields that make up a unique key. This at least makes the Import utility an option for me to achieve my goal.
Best way to do bulk create/update via API
Collapse
X
-
I'm also a little confused by how the Create & Update case works for the Import endpoint. It seems like updates only work if you pass an "id" column with the ID of each entity, but at creation time you don't have that ID. If I use a CSV with the Import UI that does not have the "id" specified as a column and use the Create & Update option, nothing gets created or updated. So how are you supposed to use the Create & Update option and what is the intended behavior?
I was hoping this would achieve functionality similar to an Insert-On-Duplicate-Key-Update query, where it would try to insert, but on existing keys it would just update the record. If that were the case you would be able to pass rows without an "id" column and still have them get created if they are new, or get updated if there is another unique key on the entity. I'm trying to avoid having to determine ahead of time which of the rows I'm passing will be new and which will be updates, as that would require a lot of more expensive querying of the API to see if rows exist already (and I may have a lot of rows to check).Leave a comment:
-
Best way to do bulk create/update via API
For entity creation, the only way I have found to do bulk creation is to do a POST to the Import endpoint with the action set to 'create'. Similarly it looks like I can do something like action='update' to do bulk updates with the Import endpoint.
I'm wondering if this is the best way to achieve bulk creates/updates or if the entities support bulk posting/patching right to the entity REST endpoints. For example, passing a JSON array of entity definitions to Account or Account/bulk or something like that. When I tried that with a POST to Account it failed silently and created one incorrect account with missing data instead of the multiple accounts I passed. Doesn't seem to work but figured I'd ask in case there is an undocumented way of doing this.
I know how to use the massUpdate endpoint as well but that doesn't achieve what I need since it applies a single update to many entities rather than allowing individual entities to have their own updates.
Thanks.Tags: None
Leave a comment: