Coming soon: Your brand new Help Center & Community! Get a sneak-peek here

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.

Af: Christian Mogensen 19. sep 2019

RE: REST API Bulk Update

Hi,

Ok, cheers for the info :)

Af: 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

Af: 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.

Af: 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.

Af: 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

Af: 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.

Af: Tony Yates 21. okt 2019

RE: REST API Bulk Update

Are there any plans to make NSErpSyncAgent available ?

 

/Ingar 

Af: Ingar Karlsen 9. nov 2020

RE: REST API Bulk Update

Hi Ingar

No, this has not been discussed. We are of course open to feedback, and would like to hear your use case - more scenario details as to why it would make sense to use CRMScripts for conducting ERPSync operations.

From our point of view, CRMScripts are a useful utility for conducting small/short/fast operations. Anything to do with bigger/longer operations, i.e. ERP Synchronization and Quote management, are not good candidates for CRMScripts. But again, we are open to your feedback.

You can post your feedback here, so send an email to sdk@superoffice.com. 

Best regards

Af: Tony Yates 10. nov 2020

RE: REST API Bulk Update

Hi Tony

The scenario in this case is that we would like to create a company in both CRM and ERP from an custom application, and then it would be nice to use the CreateActorLink from the NSErpSyncAgent to link these companies together.

Our intension was not to use it for bulk operations.

 

 

 

Af: Ingar Karlsen 10. nov 2020

RE: REST API Bulk Update

Hi Ingar,

Synchronization is complex, and that scenario is already covered by the ERPSync Connector, where the entity is created in one system and automatically replicated over to the other.

Opening up CRMScript to bypass a solid API has potentially side-effects. Doesn't seem worth the risk. 

Why not implement an ERPSync Connector instead?

 

Af: Tony Yates 10. nov 2020

RE: REST API Bulk Update

It actually is as an adittion to an ERP sync connector.

Cause with the standard ERP connector we can get the company from ERP to be automatically created in SuperOffice, but it takes up to 20 minutes for this to happend.

And in this case that is to late. We need to have the company in SuperOffice right after it exsists in ERP. We only need the name and ID, then we let the ERP sync connector run and update all the integrated fields as usual.

The standard ERP sync connector (Keyforce in this case) does not link allready created companies, it can only create it and link it at the same time. (And then the up to 20 minutes delay gets us into trouble)

Af: Ingar Karlsen 10. nov 2020

RE: REST API Bulk Update

Take a look at Bulk upsert via the DatabaseTable agent

Here you can smash in thousands of rows into a table, with rows matching on primary keys or other fields.

Yes / we finally got around to implementing it.

 

This code adds a couple of rows to the source table, with the upsert generating primary keys as needed.

var columns = new[] { "name", "tooltip", "deleted", "rank" };

var data = new string[][]
{
new[] {"First name","This is the first name tooltip", "[I:0]","1" },
new[] {"Second name","This is the second name tooltip","[I:1]","2" }
};

var retVal = mo.Insert("source", columns, data);

 

 

 

Af: Christian Mogensen 10. nov 2020