Reputation: 11401
I'm creating a "Developer Portal" to my org where a user will be able to self-register and create apps to consume public APIs. These public API are being marked by a custom role.
Everything is working 99% fine. The user can self register, create apps, generate keys, subscribe to API and etc... the 1% that's missing is this "assignment" of the "PublicAPI" role!
Looking around the web I found this article here which shows exactly what I intend to do, but it uses SOAP, and I would like to know if there's a way to use a REST request to do so?
Upvotes: 2
Views: 243
Reputation: 66
You can achieve it via SCIM2 APIs where you can assign users to roles/groups. You can perform PATCH operation for group endpoint as described here [1]. Sample payload as below,
{
"schemas": [
"urn:ietf:params:scim:api:messages:2.0:PatchOp"
],
"Operations": [
{
"op": "add",
"value": {
"members": [
{
"display": "user",
"$ref": "https://localhost:9443/scim2/Users/a39fe03c-8d57-4b4c-a69d-5160c2384bea",
"value": "a39fe03c-8d57-4b4c-a69d-ddddddd"
}
]
}
}
]
}
[1] https://docs.wso2.com/display/IS570/apidocs/SCIM2-endpoints/#!/operations#GroupsEndpoint#patchGroup
Upvotes: 1
Reputation: 485
There is not REST API implementation out of the box for the functionalities you are requiring.
At the moment, what you are doing is invoking the Admin-service related to your function via a SOAP message. These Admin-Services are OSGI services that are invokable via SOAP requests.
If you need to access those via REST API, you have to create a JAX-RS based webapp (Not a complex task) which would consume the OSGi Service. So that you can access the Webapp via REST-API and the webapp will consume the OSGi Service and get the functionality done for you.
I wold highly recommend you to go ahead and create a webapp since it is not a complex task as it sounds.
You can find a web-app build for RegistryAdminService (where the webapp consume the OSGi service related to RegistryAdmin) in the link [1].
To a complete guide including a sample code on creating such a web-app, you can refer the following link [2].
[1] - https://github.com/abeykoon/Blog-Resources
Cheers!
Upvotes: 0