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
Related
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"}'
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 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 am trying to follow the documentation from timekit.io. I am attempting to do something as simple as send a curl request to do basic authentication as seen in this section of the docs. I have replaced the Timekit-App:name-of-app with the name of my app which I found in the app-settings of my timekit account. I also replaced the email & password with the one's I use to login into my account.
I simply copied and pasted the curl command as is into my terminal and I get a response that says {"error":"Content-type should be json!"} I am not sure if I am not supposed to copy and paste it as is, or what I may be doing wrong, but my understanding is I am supposed to get a json response with a email and a api token among some other data.
Here is my curl command.
curl -X POST \
-H 'Timekit-App: jl-fit' \
-d '{
"email": "email#email.com",
"password": "password"
}' \
https://api.timekit.io/v2/auth
Looks like you have discovered a bug in their docs/examples.
The API you're connecting to expects JSON content type, but curl by default (for POSTing data) uses application/x-www-form-urlencoded. You can fix it by adding the header field explicitly with: -H 'Content-Type: application/json'.
Also, when you use the -d/--data option, method defaults to POST, so it doesn't have to be specified explicitly.
All put together, this should work:
curl \
-H 'Content-Type: application/json' \
-H 'Timekit-App: jl-fit' \
-d '{"email": "email#email.com", "password": "password"}' \
"https://api.timekit.io/v2/auth"
When having multiple arguments, it can be convenient to keep them in an array (no need to escape newlines). For example:
args=(
-H 'Content-Type: application/json'
-H 'Timekit-App: jl-fit'
-d '{"email": "email#email.com", "password": "password"}'
"https://api.timekit.io/v2/auth"
)
curl "${args[#]}"
I have created one group in WSO2 IS by using SCIM endpoint. Then i updated the group with some members. Now i want to remove all the members from the group, I have used the same update command to do this, But i couldn't remove all the members from the group. No errors are there.
I have used the following curl commands to do this.
Create Group :
curl -v -k --user admin:admin --data "{"displayName": "groupname"}" --header "Content-Type:application/json" https://example.com:9443/wso2/scim/Groups
Update group to add one member :
curl -v -k --user admin:admin -X PUT -d "{"displayName": 'groupname' ,"members":[{"value":"dfd437b5-2e52-4077-9c31-84bc2ea8c117","display":"hasinitg"}]}" --header "Content-Type:application/json" https://example.com:9443/wso2/scim/Groups/328b8e27-4869-45c5-9857-1afa9aaacf59
Update group to remove the existing member :
curl -v -k --user admin:admin -X PUT -d "{"displayName": 'groupname' }" --header "Content-Type:application/json" https://example.com:9443/wso2/scim/Groups/328b8e27-4869-45c5-9857-1afa9aaacf59
In the current implementation it doest support to remove all members. To get this done what you will have to do is. Delete the existing group and create it with the same name.