I tried to create a tag using Github API. I made a POST request to /repos/:owner/:repo/git/tags, and I get this result:
HTTP/1.1 201 Created
But unfortunately no tag was created. The new tag simply does not exist.
What do I wrong?
The tagging didn't work for me. It shows created, but nothing appears on github. However, I managed to achieve tagging by creating pre-release. Which is not ideal, but still better than nothing:
curl --location --request POST
'https://<giturl>/repos/{owner}/{repo}/releases' \
--header 'Authorization: Basic xxx' \
--header 'Content-Type: application/vnd.github.v3+json' \
--data-raw '{
"tag_name": "v0.0.1",
"target_commitish": "master",
"name": "v0.0.1",
"body": "This is for Release v0.0.1 of the product",
"draft": false,
"prerelease": true}'
There are two types of tags -- annotated and lightweight, you can check the difference here.
As Github API puts, /repos/:owner/:repo/git/tags only created an annotated tag object, and then you should manually create a refrence with the sha of this tag object by calling create refrence api:
curl \
-X POST \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/OWNER/REPO/git/refs \
-d '{"ref":"refs/tags/tagName","sha":"the sha of tag object"}'
In another case, if you only want to add a lightweight tag to one commit, you should directly call create refrence api without the first step:
curl \
-X POST \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/OWNER/REPO/git/refs \
-d '{"ref":"refs/tags/tagName","sha":"the sha of the commit that you want to tag"}'
Related
I need to import all bug reports and attachments from my internal system to GitHub Issues.
What GitHub API parameter should I use to attach a document in my curl command?
curl -X "POST" \
-H "Accept: application/vnd.github+json" \
-H "Accept: application/vnd.github.VERSION.html" \
-H "Authorization: token <token>" \
https://api.github.com/repos/BT23/demo-repo/issues \
-d '{
"title":"Create an issue in HTML format",
"body":"<H1>Testing HTML tags</H1><P>Does it work?</P>",
"assignee": "BT23",
"milestone": 1,
"labels":["bug", "functional"]
}'
Thanks
I do not see the word file anywhere in Issues API.
And this thread confirms you cannot attach a file during Issue Creation.
Adding a file to issue or pull request seems to be done manually through drag & drop only.
I have an upcoming tool migration where I can import assignees but not inactive ones - and there is no user group by default with only active users.
So I've exported all jira users and filtered based on active - so I have a nice list of all their usernames/emails. Now I want to use the REST API to create a usergroup from the list and add each user.
From the API documentation, it's pretty straightforward:
curl --request POST \
--url '/rest/api/3/group/user' \
--header 'Authorization: Bearer <access_token>' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data '{
"accountId": "384093:32b4d9w0-f6a5-3535-11a3-9c8c88d10192"
}'
However, I'm not about to type in one by one the accountIds. How can I specify an excel list or how else can i achieve this?
Easier than I thought - Just made a bash script where accountId's is the variable to cycle through the addresses.
I am trying to use api to add new key to a path, say secret/sub path. In that path I already have two keys values, I want to add one more, the following is my api
curl --request POST --data '{"bar": "baz"}' http://127.0.0.1:8200/v1/secret/sub/cha3
The result was it didn't append this new key under secret/sub path, instead it created another new path named 'sub' under secret/secrets!
Any idea how to do add a new key? Guess I want to append new key to existing path.
My vault version is 1.0.3
curl \
--header "X-Vault-Token: ..." \
--request POST \
--data '{"bar": "baz"}' \
https://127.0.0.1:8200/v1/secret/data/sub
If you want to add more data to the same path, you will need to specify the old params (otherwise it will override it):
curl \
--header "X-Vault-Token: ..." \
--request POST \
--data '{"bar": "baz", "foo": "fee"}' \
https://127.0.0.1:8200/v1/secret/data/sub
See the documentation for more details
I made a generic title while making a github issue. While trying to explain the issue, I discovered some more details underneath which I could add to the title to explain to the developer better.
I tried to change the title but wasn't able to do that, can modify the body of the message but not the title apparently :(
I tried using [github] modify title or modify heading and few other keywords but couldn't find anything in stackoverflow.com
I even re-read https://guides.github.com/features/issues/ just to see if I missed something when I had read it few years ago.
Looking to know.
Update 2021: you can also use the GitHub CLI gh, instead of curl.
2018:
Considering the GitHub API for Issues does include an "edit issue" which does allow for the title to be modified, this should be possible.
Try (using an OAuth token as shown here):
curl -H 'Authorization: Bearer <your OAuth token>' \
-H "Content-Type: application/json-patch+json" \
-H "Accept: application/json" \
-X PATCH \
https://api.github.com/repos/:owner/:repo/issues/:number \
--data '[{ "title": "a new title" }]'
Or:
curl --request PATCH -H "Authorization: token OAUTH-TOKEN" \
https://api.github.com/repos/:owner/:repo/issues/:number \
--data '[{ "title": "a new title" }]'
I'm trying to find a way to add a label to a GitHub issue using the API. After checking the API documentation I tried the following curl request:
curl -X POST -H "Authorization: token OOOOOOOOOOOOOOOO" -H \
"Accept: application/vnd.github.symmetra-preview+json" \
-d #label.json https://api.github.com/repos/CHSUNSONG/star-platform/issues/11
label.json contains:
["submitted"]
However, I got the following response:
{
"message": "Invalid request.\n\nFor 'links/1/schema', [\"submitted\"] is not an object.",
"documentation_url": "https://developer.github.com/v3/issues/#edit-an-issue"
}
Why isn't this working and how can I fix it?
You're POSTing to the wrong URL. Add /labels onto the end:
curl -X POST -H "Authorization: token OOOOOOOOOOOOOOOO" -H \
"Accept: application/vnd.github.symmetra-preview+json" \
-d #label.json \
https://api.github.com/repos/CHSUNSONG/star-platform/issues/11/labels