web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Create body for batch ...
Power Apps
Unanswered

Create body for batch request to Dataverse REST API in Python

(0) ShareShare
ReportReport
Posted on by 87

Hi there,

Hoping someone can help with a really dumb question concerning API call.

 

I want to create a batch request for a Fetch XML query.  After a day's effort I managed to get it working on Postman OK.  But I cannot get it to work properly in Python because I cannot properly prepare the body of the API request.

 

Here is how the body looks in Postman:

mhaupt_0-1711540525927.png

But because it doesn't appear to be in the form of a dictionary, I am scratching my head how to prepare it in my Python script.

 

Worth mentioning when I save a copy of the body as a text file and use that as the source of the body for the API call in Python it works fine.  But surely there is a way to prepare the request body without saving as a text file?

I have the same question (0)
  • Verified answer
    mhaupt Profile Picture
    87 on at

    I sorted it.  Being multipart, I can read the body as a string, though I needed to point the request at the first character, i.e request.post(url=requesturl,data=JSONString[0:])

    , to avoid ".JSONDecodeError: Expecting value: line 1 column 1 (char 0)"

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 796 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 327 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard