title: github actions repository dispatch "message": "Problems parsing JSON"
body: <p>I am trying to create an actions workflow that can be triggered from an external event. Upon researching, found out I can do it through repository_dispatch.</p>
  <p>I need to trigger the actions through python but I get this error and status code 400:</p>
  <blockquote>
  <p>{'message': 'Problems parsing JSON', 'documentation_url':
  'https://docs.github.com/rest/reference/repos#create-a-repository-dispatch-event'}</p>
  </blockquote>
  <p>I then serialized the payload dictionary to string with json.dumps() and the error changed to with code 422:</p>
  <blockquote>
  <p>{'message': 'Invalid request.\n\nFor 'links/0/schema',
  &quot;{&quot;event_type&quot;: &quot;test&quot;, &quot;client_payload&quot;: {&quot;unit&quot;: false,
  &quot;integration&quot;: true}}&quot; is not an object.', 'documentation_url':
  'https://docs.github.com/rest/reference/repos#create-a-repository-dispatch-event'}</p>
  </blockquote>
  <p>Here's my code snippet that I constructer from the curl example provided in the docs</p>
  <pre><code>import requests
  import json
  
  url = &quot;https://api.github.com/repos/larwindcunha/&lt;repo&gt;/dispatches&quot;
  payload = {&quot;event_type&quot;: &quot;test&quot;, &quot;client_payload&quot;: {&quot;unit&quot;:False,&quot;integration&quot;:True}}
  header = {&quot;Accept&quot;: &quot;application/vnd.github+json&quot;, &quot;Authorization&quot;: &quot;token &lt;my_token&gt;&quot;}
  payload = json.dumps(payload)
  resp = requests.post(url=url, headers=header, json=payload)
  </code></pre>
  <p>When I try running the curl command provided here - <a href="https://docs.github.com/en/rest/repos/repos#create-a-repository-dispatch-event" rel="nofollow noreferrer">https://docs.github.com/en/rest/repos/repos#create-a-repository-dispatch-event</a>, I get the same error with code 400:</p>
  <blockquote>
  <p>{'message': 'Problems parsing JSON', 'documentation_url':
  'https://docs.github.com/rest/reference/repos#create-a-repository-dispatch-event'}</p>
  </blockquote>
  <pre><code>curl \
    -X POST \
    -H &quot;Accept: application/vnd.github+json&quot; \ 
    -H &quot;Authorization: token &lt;MY_TOKEN_HERE&gt;&quot; \
    https://api.github.com/repos/OWNER/REPO/dispatches \
    -d '{&quot;event_type&quot;:&quot;on-demand-test&quot;,&quot;client_payload&quot;:{&quot;unit&quot;:false,&quot;integration&quot;:true}}'
  </code></pre>
  <p>Does you guys know if I'm doing something wrong here? Or is repository dispatch broken? Any help would be appreciated.</p>