Sharepoint _API/$batch response is not in JSON format

Copper Contributor

Like, If I'm trying to call the Batch API
https://xyz.sharepoint.com/sites/abc/_api/$batch

I'm getting response in the text format But I want it to be a JSON

--batchresponse_cdd522a4-cf21-4c48-8b5b-808574047560

Content-Type: application/http

Content-Transfer-Encoding: binary

 

HTTP/1.1 400 Bad Request

CONTENT-TYPE: application/json;odata=verbose;charset=utf-8

 

{"error":{"code":"-1, Microsoft.SharePoint.Client.InvalidClientQueryException","message":{"lang":"en-US","value":"The property '_test_' does not exist on type 'SP.Data.TDCE136ListItem'. Make sure to only use property names that are defined by the type."}}}

--batchresponse_cdd522a4-cf21-4c48-8b5b-808574047560--

2 Replies

@Rishabh-Gupta Try passing accept and content-type headers like below with REST API request: 

 

var jsonSPHeaders = {  
    "Accept": "application/json;odata=verbose", 
    "Content-Type": "application/json;odata=verbose"
}

 

  1. Basic batched GET requests using REST API 
  2. SharePoint Online : Performing Batch Operations using REST API 

Please click Mark as Best Response & Like if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.

For SharePoint/Power Platform blogs, visit: Ganesh Sanap Blogs

Hi, But I'm using multipart/mixed headers as well
self.headers["Content-Type"] = f'multipart/mixed; boundary="batch_{batch_guid}"'