# Problem passing JSON to Gitea API

**URL:** https://forum.gitea.com/t/problem-passing-json-to-gitea-api/10055
**Category:** Install/Maintain/Configure
**Created:** [November 17, 2024, 9:04pm UTC](https://forum.gitea.com/t/problem-passing-json-to-gitea-api/10055 "2024-11-17T21:04:18Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![rob.nicholson](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.gitea.com/rob.nicholson/32/6339_2.png) [@rob.nicholson](https://forum.gitea.com/u/rob.nicholson)
#### Post date: [November 17, 2024, 9:04pm UTC](https://forum.gitea.com/t/problem-passing-json-to-gitea-api/10055/1 "2024-11-17T21:04:18Z")

</div>

Probably a very simple problem that belies that I’m not that familiar with Unix commands. Trying to create a repository using the Gitea API. I’ve got it working to check if a repository exists but this is the curl I’m trying to execute to create a test repository:

> curl.exe -k -H “content-type: application/json” -H “Authorization: token xxx” [https://gitea.mydomain.co.uk:3000/api/v1/user/repos](https://gitea.mydomain.co.uk:3000/api/v1/user/repos) -d ‘{“name”: “test1”}’

And I get this result:

> {“message”:“: invalid character ‘n’ looking for beginning of value”,“url”:“[https://gitea.mydomain.co.uk:3000/api/swagger](https://gitea.mydomain.co.uk:3000/api/swagger)”}

It’s clearly a problem with the JSON I’m trying to pass, i.e. if I change “name” to “xame”, the invalid character is ‘x’.

Later… since posting the above in another topic (bad form), I’ve got it working using PowerShell **Invoke-WebRequest**. I’m executing curl from a PowerShell script anyway so this is perfectly fine and slightly cleaner.

Still intrigued what I’m doing wrong though with the curl command.

---

<div class="post-metadata">

### Author: ![rob.nicholson](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.gitea.com/rob.nicholson/32/6339_2.png) [@rob.nicholson](https://forum.gitea.com/u/rob.nicholson)
#### Post date: [November 17, 2024, 9:20pm UTC](https://forum.gitea.com/t/problem-passing-json-to-gitea-api/10055/2 "2024-11-17T21:20:36Z")

</div>

Answering my own question as I found a similar thread on StackOverlow. It’s something to do with the PowerShell parser. You have to quote the JSON like this:

`-d '{\"name\": \"test1\"}'`

It’s also important to use single quotes around the entire string and not double-quotes. I’m sure another hour of research would reveal the parser quirk that’s causing this.
