Skip to main content

Hi Experts,

There is a requirement to use ‘Batch’ operation to Delete all child records and insert new child records based on the provided information.

I have used below code snippet to achieve the deletion part.

Requirement: Delete all part needs which have task_id = 253

--batch_d3bcb804-ee77-4921-9a45-761f98d32029
Content-Type: multipart/mixed; boundary=changeset_77162fcd-b8da-41ac-a9f8-9357efbbd621

--changeset_77162fcd-b8da-41ac-a9f8-9357efbbd621
Content-Type: application/http
Content-Transfer-Encoding: binary

DELETE http://hagilk0/DEMOFSMServer6_4/odata/part_need HTTP/1.1
Content-Type: application/json
Content-ID: 1

{
"task_id":"253"
}

--changeset_77162fcd-b8da-41ac-a9f8-9357efbbd621--
--batch_d3bcb804-ee77-4921-9a45-761f98d32029

This is the response that I have received by using the above code.

--batchresponse_1e699066-e693-477a-b4fa-7bac247e6ea8
Content-Type: multipart/mixed; boundary=changesetresponse_2702cf6f-cacf-492a-b213-6656d825b932

--changesetresponse_2702cf6f-cacf-492a-b213-6656d825b932
Content-Type: application/http
Content-Transfer-Encoding: binary
Content-ID: 1

HTTP/1.1 500 Internal Server Error
Content-Type: application/json; charset=utf-8

{"Message":"One or more errors occurred in the batch request."}
--changesetresponse_2702cf6f-cacf-492a-b213-6656d825b932--
--batchresponse_1e699066-e693-477a-b4fa-7bac247e6ea8--

Is there a way to find the errors which are mentioned by the Response(‘One more more errors occurred in the batch request’)

Could you please let me know whether this requirement is possible to achieve through ‘DELETE’ in a batch operation.

 

Thanks,

Hasara

Hi Experts,

 

I was able to achieve the request deletion, task deletion by using the below code snippet. 

--batch_d3bcb804-ee77-4921-9a45-761f98d32029
Content-Type: multipart/mixed; boundary=changeset_77162fcd-b8da-41ac-a9f8-9357efbbd621

--changeset_77162fcd-b8da-41ac-a9f8-9357efbbd621
Content-Type: application/http
Content-Transfer-Encoding: binary

DELETE http://hagilk0/DEMOFSMServer6_4/odata/task(253) HTTP/1.1
Content-Type: application/json
Content-ID: 1

--changeset_77162fcd-b8da-41ac-a9f8-9357efbbd621--
--batch_d3bcb804-ee77-4921-9a45-761f98d32029

But my requirement is, to delete all the part need for the specific task ID. Below is the latest code snippet I have tried so far.(I have tried to use $filter with the DELETE operation).

But It seems this requirement is not possible without providing the primary key directly for the DELETE URL.

--batch_d3bcb804-ee77-4921-9a45-761f98d32029
Content-Type: multipart/mixed; boundary=changeset_77162fcd-b8da-41ac-a9f8-9357efbbd621

--changeset_77162fcd-b8da-41ac-a9f8-9357efbbd621
Content-Type: application/http
Content-Transfer-Encoding: binary

DELETE http://hagilk0/DEMOFSMServer6_4/odata/part_need?$filter=task_id eq '245' HTTP/1.1
Content-Type: application/json
Content-ID: 1

--changeset_77162fcd-b8da-41ac-a9f8-9357efbbd621--
--batch_d3bcb804-ee77-4921-9a45-761f98d32029

Any feedback is highly appreciate.

 

Thanks and regards,

Hasara


Hi @Hasara Dinu ,

Sachintha weerasekara  from RnD should be able to assist you on this and let us know the outcome.


Reply