Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.
I am trying to create Eventstream with defination using API
Code :
Solved! Go to Solution.
Hi @chetanhiwale
Thank you for reaching out microsoft fabric community forum.
The issue looks like it’s coming from how the request is being sent. In your code, when you're calling the requests.post() method, you're passing the payload dictionary directly using data=payload. But the data parameter expects a JSON string, not a raw Python dictionary.
To fix this, try converting the payload to a JSON string before sending it. Just update this line:
data = payload
to:
data = json.dumps(payload)
That should resolve the “unexpected character” error ("d" is from the dict string). Also, make sure your base64-encoded definition is valid and the Eventstream/workspace IDs are correct.
If this solution helps, please consider giving us Kudos and accepting it as the solution so that it may assist other members in the community
Thank you.
May I ask if you have resolved this issue? If so, please mark the helpful reply and accept it as the solution. This will be helpful for other community members who have similar problems to solve it faster.
Thank you.
Hi @chetanhiwale
I hope this information is helpful. Please let me know if you have any further questions or if you'd like to discuss this further. If this answers your question, please Accept it as a solution and give it a 'Kudos' so others can find it easily.
Thank you.
Hi @chetanhiwale
I wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions. If my response has addressed your query, please accept it as a solution and give a 'Kudos' so other members can easily find it.
Thank you.
Hi @chetanhiwale
Thank you for reaching out microsoft fabric community forum.
The issue looks like it’s coming from how the request is being sent. In your code, when you're calling the requests.post() method, you're passing the payload dictionary directly using data=payload. But the data parameter expects a JSON string, not a raw Python dictionary.
To fix this, try converting the payload to a JSON string before sending it. Just update this line:
data = payload
to:
data = json.dumps(payload)
That should resolve the “unexpected character” error ("d" is from the dict string). Also, make sure your base64-encoded definition is valid and the Eventstream/workspace IDs are correct.
If this solution helps, please consider giving us Kudos and accepting it as the solution so that it may assist other members in the community
Thank you.
I really don't know if this is the real error - but the word "definition" in the first line has a misspelling.
Else I would look for the error where it says "d" in the error message. It can uspbe a good hint, even though JSON parsing often just gives the first character from an arbitrary place during the parsing...
I hope you find the error - if it is not the misspelling in the beginning 😊
Hi @datacoffee , thanks for pointing it out. As far as I can see, it is only variable , so it should affect it code execution. Even after correct the word, the error still persists. No sure exactly why I am getting this error.
I agree - the code looks good to me - I can't seem to find any error.
And yes - it is only a variable used in the "payload" definition.
I'm sorry for not being able to help more in this matter...
Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!
Turn streaming data into instant insights with Microsoft Fabric. Learn to connect live sources, visualize in seconds, and use Copilot + AI for smarter decisions.
Check out the September 2025 Fabric update to learn about new features.