Question

DataService - BatchQuery with Inserts

I am attempting to execute the BatchQuery DataService method and insert multiple records. From what I can tell, I've formatted the request correctly as below:

{
   "items":[
      {
         "queryKind":0,
         "columnValues":{
            "items":{ ... }
         },
         "rootSchemaName":"Account",
         "__type":"Terrasoft.Nui.ServiceModel.DataContract.InsertQuery",
         "operationType":"1"
      },
      { ... }
   ]
}

I've attached the full request that is being sent. The response I'm getting is:

{"queryResults":[]}

So, it's as if it's not even seeing my requests.

I have been successful in getting Batch SelectQuery to work. Could you review my request and tell me what may be missing?

File attachments
Like 1

Like

4 comments

It's strongly not recommended to insert multiple records via DataService. You're going to emulate the out-of-the-box functionality and if the integration drops the system then it will be barely possible to find the reason. Please use a custom web service for the integration. 

Eugene Podkovka,

Is the intention of BatchQuery to only perform batched SelectQuery's? Is it not capable of doing an InsertQuery? I don't understand why it would be hard to find the reason of a failure - wouldn't the message be returned within the queryResult array?

Aron Hoekstra,

As the integration developer, you have to think not only about the code of the queries but also about the server resources that your integration will consume and about logging that you will use if the integration fails. How will you investigate the resource consumption of the dataservice? How will you create the integration logging? If you use a custom web service, then you'll be able to do that via native c#. If you use dataservice, It will be much harder for you. 

We've figured this out. It seems "__type" needs to be the FIRST entry within each item. Not sure why order matters at all within a json payload, but apparently it does for this endpoint. Each response is returned as expected within an array.

Show all comments