I have a private GitHub repository hosted in a GitHub organization.
The repo contains a GitHub Action with the `workflow_dispatch` option
(cf. [GitHub Documentation](https://docs.github.com/en/actions/reference/events-that-trigger-workflows#workflow_dispatch)).

Excerpt from the Action YAML file:

```yaml
on:
  # Allows you to run this workflow manually from the Actions tab
  workflow_dispatch:

jobs:
  build:
    runs-on: ubuntu-latest

```

I can successfully trigger this Action from the GitHub Actions tab.

However, I would like to be able to trigger this Action through a `POST` request to the GitHub API.
This should be possible using the GitHub API.
The relevant API endpoint seems to be `/repos/{owner}/{repo}/actions/workflows/{workflow_id}/dispatches` as described in the
[Documentation](https://docs.github.com/en/rest/reference/actions#create-a-workflow-dispatch-event).

The Documentation further states:

> 
> You must authenticate using an access token with the repo scope to use this endpoint.
> 
> 
> 

Thus, in my personal account Settings under "Developer settings" → "Personal access tokens",
I have created a token and granted access to all "repo" items as well as the "workflow" item.

I have tested triggering the GitHub Action by making a `POST` request using `curl` as well as [Postman](https://www.postman.com).
To that end I use the following parameters as per the
[GitHub Documentation](https://docs.github.com/en/rest/reference/actions#create-a-workflow-dispatch-event):

* `accept`: `application/vnd.github.v3+json` (per GitHub recommendation)
* `owner`: name of the GitHub õrganization
* `repo`: name of the repository
* `workflow_id`: using the full file name of the GitHub Action YAML file (including the ending, `.yml`), as I'm not sure where to find the ID.
* `ref`: `main`, as I think this refers to the relevant repository branch (?) and the repo has only a `main` branch and the Action resides there

Using the `curl` example from the [Documentation](https://docs.github.com/en/rest/reference/actions#create-a-workflow-dispatch-event) (but adding authentication to it):

```sh
curl -X POST -H "Accept: application/vnd.github.v3+json" \
  -u GITHUBUSERNAME:GITHUBPERSONALACCESSTOKEN \
  https://api.github.com/repos/ORGNAME/REPONAME/actions/workflows/YMLFILE/dispatches \
  -d '{"ref":"main"}'

```

I get the following result:

```json
{
  "message": "Problems parsing JSON",
  "documentation_url": "https://docs.github.com/rest/reference/actions#create-a-workflow-dispatch-event"
}

```

I also tested issuing the `POST` request from [Postman](https://www.postman.com) (by importing the above `curl` statement).
This yields exactly the same result.

1. Do I need to configure the GitHub end of this process differently?
2. Is my `curl` statement wrong?
3. Is there any way I can inspect the "problem[atic] JSON" in order to find out what is going on?