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.
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 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'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
For a remote administration of multiple Glassfish 3.1.2.2 instances I want to configure resource adapter connection pool and connector resources. These configuration can only be done after the resource adapter deployment.
All works if I do things with asadmin.
Get Access via REST works as expected.
Example:
curl --user admin:pwd -X GET -H "Accept: application/JSON"
http://localhost:4848/management/domain/resources/connector-connection-pool
Now I want to create a connection pool using the following command with REST
asadmin create-connector-connection-pool --raname MulticastDNS-connector
--connectiondefinition multicastdns.outbound.MulticastDNSRegistry multicastdns/pool
I followed some of the Oracle examples http://docs.oracle.com/cd/E18930_01/html/821-2416/gjipx.html#gjijx or http://docs.oracle.com/cd/E19798-01/821-1751/gjijx/index.html
But all things I tried got 400 Bad Requests.
Example:
curl --user admin:pwd -X POST -H "Accept: application/JSON" -H "Content-Type: application/json"
-d '{"id":"multicastdn%2fspool","connectiondefinitionname":"multicastdns.outbound.MulticastDNSRegistry","resourceAdapterName":"MulticastDNS-connector"}'\
http://localhost:4848/management/domain/resources/connector-connection-pool -v
# other check
curl --user admin:pwd -X POST -H "Accept: application/JSON" \
-d id=multicastdns%2fpool \
-d connectiondefinitionname=multicastdns.outbound.MulticastDNSRegistry \
-d resourceAdapterName=MulticastDNS-connector \
http://localhost:4848/management/domain/resources/connector-connection-pool -v
Simular results if I want to delete a existing resource.
curl --user admin:pwd -X DELETE -H "Accept: application/JSON" \
http://localhost:4848/management/domain/resources/connector-connection-pool/multicastdns%2fpool -v
# other try
curl --user admin:pwd -X DELETE -H "Accept: application/JSON" \
-d id=multicastdns%2fpool \
http://localhost:4848/management/domain/resources/connector-connection-pool -v
Same issue if try the second step with connector resource
asadmin create-connector-resource --poolname multicastdns/pool jca/multicastdns
Get via REST works but add and delete an entry won't work.
Thanx florian