Forum Discussion

chetanhiwale's avatar
chetanhiwale
Resolver I
1 year ago
Solved

Issue with definition for Fabric event-stream API

I am trying to create Eventstream with defination using API Code :  defination = {   "sources": [     {       "name": "xvxcv",       "type": "CustomEndpoint",       "properties": {}     }  ...
  • Anonymous's avatar
    Anonymous
    1 year ago

    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.