2

trying to create repository via API. using swagger execute mode:

curl -X POST "https://URL/git/api/v1/user/repos?access_token=XXXXX" -H "accept: application/json" -H "Content-Type: application/json" -d "{ \"auto_init\": true, \"description\": \"blablabla\", \"gitignores\": \"string\", \"issue_labels\": \"string\", \"license\": \"string\", \"name\": \"blablabla\", \"private\": true, \"readme\": \"string\"}"

yields 500 error, complains about readme.

{"message":"initRepository: prepareRepoCommit: getRepoInitFile[string]: open /readme/string: file does not exist","url":"URLr"}

Guess because of this param:

"readme\": \"string\"

I don’t know what’s the suggested value for that but it’s in swagger docs.
any ideas ?

Vano
  • 1,416
  • 1
  • 13
  • 26

1 Answers1

4

The default json body params supplied by swagger are not working.

This did the trick:

{
  "auto_init": true,
  "description": "blablabla",
  "gitignores": "",   <--- empty string instead of defaults
  "issue_labels": "", <--- empty string instead of defaults
  "license": "",      <--- empty string instead of defaults
  "name": "ccc2",
  "private": true,
  "readme": ""        <--- empty string instead of defaults
} 
Vano
  • 1,416
  • 1
  • 13
  • 26