We’ve developed some resources to help you work effectively from home during COVID-19 Click to learn more

REST API Bulk Update

Hi,

Just wanted to check what the best approach would be if wanted to bulk update Person object (with more field, emails etc) using the REST API. Is there any way to send an array with multiple persons, or do we have to loop all persons and make one call to PUT/PATCH per person?

(We're talking 100.000+ persons).

From the documentation it only seems that we can call GET without ID to get everything out, but is there any similar method of putting it back in?
(We want to run it daily for everything, and also on shorter basis using updated dates etc).

RE: REST API Bulk Update

Not yet - we are looking at developing a bulk upsert API.

Av: Christian Mogensen 19. sep 2019

RE: REST API Bulk Update

Hi,

Ok, cheers for the info :)

Av: Rikard Fredlund 19. sep 2019

RE: REST API Bulk Update

Hi,

What about using CRMScript for BulkUpdates, is it possible to change multiple persons at the same time there, without having to loop through each one?

Does anybody know of any good examples using CRMScript, like Tonys .NET Tutorial below?

https://community.superoffice.com/en/content/content/netserver-sdk/netserver-8.x/bulk-update-api/?


Best Regards
Marcus

Av: Marcus Svenningsson 24. sep 2019

RE: REST API Bulk Update

Hi Marcus, 

there is a NSBulkUpdateAgent in CRMScript, but unfortunately it doesn't work :/

You can use SearchEngine to mass-update with the .update(), though.

Av: Frode Lillerud 24. sep 2019

RE: REST API Bulk Update

As I said in Rikards other post, which was on the exact same topic, use the Restful Agent API's, you need to use the /api/v1/BulkUpdate/Agent (POST) API.

Av: Tony Yates 24. sep 2019

RE: REST API Bulk Update

Frode:
Regarding "NSBulkUpdateAgent", do not work. Is it like an empty shell where nothing is implemented or is there some other problem?

Regarding the se.update()-method:
To make this work "kind of" the same as the Bulk Update, this would mean that the criteria would be a list of ID's and the AddData, would be the static value to set to all records affected, right?

Tony:
If the "NSBulkUpdateAgent" isn't implemented in CRMScript, is there any plans on that?

As the SO Web Client's Bulk Update GUI-feature is using the REST API, I suppose that the REST API is publicly available to some degree (I suppose that piggybacking is possible) in Online even though it isn't available from an external system without the wrapping of a custom app.

1. Is the REST API available for a script or macro run or triggered by a GUI-event when a user is logged in and working in the web app? I suppose that is uses the authentication of the user and that the web client itself uses this kind of access to the REST API?

2. What about scheduled scripts in Online? Do they have full access to the REST API? In onsite they are run as the service system user and I suppose that is the same case in Online. Even though the system accounts isn't visbile in the Admin GUI, I have noticed that they still are used for partner apps, etc.

3. A custom service screen containing a Boostrap "SPA" (Single Page Application) javascript-solution. Will it have access to the REST API or are REST-calls made from that SPA seen  as an external application, not able to piggybacking on the logged in user's authentication?


Best Regards
Marcus

Av: Marcus Svenningsson 25. sep 2019

RE: REST API Bulk Update

These agents are not available in CRMScripts:

  • NSEMailAgent
  • NSTrayAppAgent
  • NSAudienceAgent
  • NSErpSyncAgent
  • NSPartnerAgent
  • NSDashboardAgent
  • NSDatabaseAgent
  • NSBulkUpdateAgent
  • NSCRMScriptAgent
  • NSDatabaseTableAgent

While the web client has the ability to access the XSRF_TOKEN that resides in the clients' page, there is no way today to get a user credential for the current user to call the REST web services from CRMScript - which is executing on the application server.

Best regards.

Av: Tony Yates 21. okt 2019