Skip to content
This repository has been archived by the owner on Mar 25, 2023. It is now read-only.

Test Gitea api with curl #18

Open
SimonLab opened this issue May 20, 2022 · 3 comments
Open

Test Gitea api with curl #18

SimonLab opened this issue May 20, 2022 · 3 comments
Assignees
Labels
discuss Share your constructive thoughts on how to make progress with this issue documentation Improvements or additions to documentation enhancement New feature or request T25m Time Estimate 25 Minutes

Comments

@SimonLab
Copy link
Member

SimonLab commented May 20, 2022

For example to create a new repository in an organisation:

curl -X POST -H "Content-Type: application/json" \
    -H "Authorization: token <your-token>" \
    -d '{"name": "repo", "readme": "thereadme"}' \
    https://gitea-server.fly.dev/api/v1/orgs/your_org/repos

I'm testing this endpoint as I would like the repository to be created automatically with a Readme file included.
However I haven't managed to do this. There is "readme" key that can be passed in the post body (define in Gitea doc), however this doesn't seem to work.

@SimonLab SimonLab added the documentation Improvements or additions to documentation label May 20, 2022
@SimonLab
Copy link
Member Author

Adding the "auto_init": true, in the body request will create a README.md file automatically. I thought adding the "readme": "filename" would create the filename instead of README.md but the request fails

curl -X POST -H "Content-Type: application/json" \
    -H "Authorization: token <your-token>" \
    -d '{"auto_init": true, "name": "repo"}' \
    https://gitea-server.fly.dev/api/v1/orgs/your_org/repos

SimonLab added a commit that referenced this issue May 20, 2022
Add auto_init to automatically create the initialisation of the repository.
This will create the README.md file when the repository is created

see: #18
@nelsonic
Copy link
Member

@SimonLab do you want to add this to this README.md or to https://github.com/dwyl/gitea-server ❓ 💭

@nelsonic nelsonic added enhancement New feature or request discuss Share your constructive thoughts on how to make progress with this issue T25m Time Estimate 25 Minutes labels May 27, 2022
@SimonLab
Copy link
Member Author

Good idea, I'll add it.
I noticed also the API documentation (see #5) contains example of the curl command when you try the endpoint:
image

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
discuss Share your constructive thoughts on how to make progress with this issue documentation Improvements or additions to documentation enhancement New feature or request T25m Time Estimate 25 Minutes
Projects
None yet
Development

No branches or pull requests

2 participants