Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
"Cannot unmarshal" error when creating a repo via the API #2535
for an undergoing ansible setup, i want to create some repos via the API. So i made a POST-request against the API with the following json content to test the creation of repos via the API:
Unfortunately i get an HTTP error 400 with the following content:
So i tried the request with
I know that the API is still in beta, but all other API requests i have made (speak: Adding an SSH key to a user account) worked perfectly fine, so i'm just asking for help with this API call now.
Hmm...this is funny. I have updated gogs to version 0.8.25.0129 and now it works via curl and the command line. But i still have problems with accessing the API via ansible.
Just for the records: This is the task executed by ansible:
And this is the result:
What is funny is the following: In the same ansible playbook i make sure that the user's public key is already in gogs's database. The task is exactly the same, the only thing that changes is the URL and the content of the body. However, the inserting of the SSH key succeeds, while the creation of the repository does not.
I am quite sure that this isn't ansible's fault, and also not gogs's fault. But it has to be someone's fault ;)
What's irritating me is the error:
UPDATE: I have validated the JSON i am sending to the API with http://jsonlint.com/. It is a valid JSON.
Even more Update: I was suspicious about your test-json, which contained only the
Well - i think i fixed it. Somehow i had a double-json-casting in my ansible task. In the task was a normal json created, which then was encapsulated in json again. This was no problem with the API-access of /users/keys, since a jsonified string becomes a string again.