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

Announcements

News and Announcements icon
Community site session details

Community site session details

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

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 528

#2
WarrenBelz Profile Picture

WarrenBelz 426 Most Valuable Professional

#3
Valantis Profile Picture

Valantis 306

Last 30 days Overall leaderboard