I'm trying this with curl:
first insert a document:
curl --user admin:admin -X POST -d '{"#class":"Question"}' http://127.0.0.1:2480/document/home/
{"#type":"d","#rid":"#13:3","#version":6,"#class":"Question"}
second insert a document with a reference to the first one inside the items list
curl --user admin:admin -X POST -d '{"#class":"Question", "items":[{"#rid":"#13:3"}]}' http://127.0.0.1:2480/document/home/
{"#type":"d","#rid":"#13:2","#version":2,"#class":"Question","items":[{"#rid":"#13:3"}]}
finally I tried to get the last document:
curl --user admin:admin -X GET http://127.0.0.1:2480/document/home/13:2
{"#type":"d","#rid":"#13:2","#version":2,"#class":"Question","items":[{"#rid":"#13:3"}]}
But I need this:
{"#type":"d","#rid":"#13:2","#version":2,"#class":"Question","items":[{"#type":"d","#rid":"#13:3","#version":6,"#class":"Question"}]}
This is the documentation page:
https://github.com/orientechnologies/orientdb/wiki/OrientDB-REST
Edit:
I tried this and it did not work
curl --user admin:admin -X GET http://127.0.0.1:2480/document/home/13:2/*:-1
{"#type":"d","#rid":"#13:2","#version":2,"#class":"Question","items":[{"#rid":"#13:3"}]}
The second insert must contains the RID only:
{"#type":"d","#rid":"#13:2","#version":2,"#class":"Question","items":["#13:3"]}
To retrieve the full tree/graph set the fetch plan. Take a look at: https://github.com/orientechnologies/orientdb/wiki/OrientDB-REST#get---document
Use:
curl --user admin:admin -X GET http://127.0.0.1:2480/document/home/13:2/*:-1
Related
I'm trying to link a ADO Requirement work item to a ADO Test Case work item. I'm making this call:
curl -u :********** -X PATCH -H "Content-Type: application/json-patch+json" -H "Accept: application/json-patch+json" -d "[{{\"op\": \"test\", \"path\": \"/rev\",\"value\": 3 },{\"op\": \"add\", \"path\": \"/relations/-\", \"value\":\"{\"rel\": \"System.LinkTypes.Dependency-forward\",\"url\": \"https://***.***.com/{Organisation}/_apis/wit/workItems/{ID}\",\"attributes\": {\"comment\": \"Making a new link for the dependency\"}}}}]" https://***.***.com/{Organisation}/{Project}/_apis/wit/workItems/{ID}?api-version=6.0
as per: https://learn.microsoft.com/en-us/rest/api/azure/devops/wit/work-items/update?view=azure-devops-rest-7.1#add-a-link
But I'm having this error:
{"$id":"1","innerException":null,"message":"You must pass a valid patch document in the body of the request.","typeName":"Microsoft.VisualStudio.Services.Common.VssPropertyValidationException, Microsoft.VisualStudio.Services.Common","typeKey":"VssPropertyValidationException","errorCode":0,"eventId":3000}
I found my answer, the JSON was badly parse. I used a online JSON linter to fix it. https://jsonlint.com/
curl -u :********** -X PATCH -H "Content-Type: application/json-patch+json" -H "Accept: application/json-patch+json" -d "[{\"op\": \"add\", \"path\": \"/relations/-\", \"value\":{\"rel\": \"Microsoft.VSTS.Common.TestedBy-Forward\",\"url\": \"https://***.***.com/{Organisation}/_apis/wit/workItems/{ID}\",\"attributes\": {\"comment\": \"Making a new link for the dependency\"}}}]" https://***.***.com/{Organisation}/{Project}/_apis/wit/workItems/{ID}?api-version=6.0
im looking at apache Ranger rest API to add an existing internal user/users to an existing internal group.
I have been looking at the docs and cant seem to find something useful,is there an API for that?
Try following api call:-
curl -ivk -u admin:admin -H "Content-Type: application/json" -d '{"id":13,"createDate":"2020-12-23T07:55:04Z","updateDate":"2020-12-23T07:55:04Z","owner":"rangerusersync","updatedBy":"rangerusersync","name":"atlas","password":"*****","description":"atlas - add from Unix box","groupIdList":[6,59,4,131,133],"groupNameList":["atlas","hadoop","shadow"],"status":0,"isVisible":1,"userSource":1,"userRoleList":["ROLE_USER"],"otherAttributes":"{\"full_name\":\"atlas\",\"original_name\":\"atlas\"}"}' -X PUT https://RANGER_HOST:6182/service/xusers/users
Its little bit big but if user is already added to ranger then run following api to get the id information for users:-
curl -ivk -u admin:admin -H "Accept : application/json" -X GET https://RANGER_HOST:6182/service/xusers/users
Once you have IDs for all users, you can run following curl api to get the json formatted data which you can use to modify and then use PUT method in first API I mentioned:-
curl -ivk -u admin:admin -H "Accept: application/json" -X GET https://RANGER_HOST:6182/service/xusers/users/13
Above Curl api should return something like following:-
{"id":13,"createDate":"2020-12-23T07:55:04Z","updateDate":"2020-12-23T16:45:14Z","owner":"rangerusersync","updatedBy":"admin","name":"atlas","password":"*****","description":"atlas - add from Unix box","groupIdList":[133,6],"groupNameList":["apitest","atlas","hadoop","shadow","ssb"],"status":0,"isVisible":1,"userSource":1,"userRoleList":["ROLE_USER"],"otherAttributes":"{\"full_name\":\"atlas\",\"original_name\":\"atlas\"}"}
you have to modify "groupIdList":[133,6] from the above output copy entire output and pass it with PUT method as shown in the first api call mentioned above.
I am trying to delete grafana dashboard using curl command, but it is not deleting, the below curl command I tried to delete the dashboard,
curl -XPOST -d '{"name":"mydashboard"}' http://localhost:3000/api/dashboards/db -u admin:admin -H "Content-Type: application/json"
Run the below command,
curl -k -X DELETE -u admin:admin http://localhost:3000/api/dashboards/db/dashboardslug_name
where dashboardslug_name is the name while save the dashboard and not the dashboard title displaying in the web url.
I'm attempting to execute the following CURL call via commandline:
curl -i -H "Content-Type:application/json" \
-u "m19389#dev.acp.co.com:qE2P/N7y1k.\(" \
-X GET -d "https://wefd.it.co.com:3905/events/com.co.mpm.dev.29160-wgdhfgd-v1/dsd/dsdfds-0-0-1-7c49768976-2g7kq"
I've added quotes around the arguments and all, and I'm definitely inclusing the curl url, so I'm not sure what's going on here. Where did I go wrong?
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.