Software AG Products 10.7 | Using API Gateway | Usage Scenarios | Change Ownership of Assets | How Do I Change the Ownership of Multiple Assets?
 
How Do I Change the Ownership of Multiple Assets?
It is convenient to change the asset ownership for multiple assets with a single REST request than doing it separately for individual assets. This use case explains how to change the ownership of multiple assets by sending a REST request. You can configure an approval process, if required, for the change of ownership to take effect.
The use case starts when multiple assets require change of owner and ends when you successfully change the ownership of the assets to another user.
*To change the ownership of multiple assets
1. Use the following REST request to change the asset ownership to a new user.
POST http://host:port/rest/apigateway/assets/owner
Content-Type: application/json
{
"assetType": "*", (API/APPLICATION)

"assetIds": ["*"],

"currentOwner": "user1",

"newOwner": "user2"
}
Provide the following information in the REST request:
*assetType. Specifies the asset type for which you want to change the owner. Available values are API, APPLICATION, or the wildcard *. The wildcard * specifies all the assets, APIs and applications owned by the user specified in currentOwner.
*assetIds. Specifies the ID of the assets specified in assetType.
Note:
This is optional. assetIds is not required if you specify currentOwner.
*currentOwner. Specifies the user name of the owner of the assets specified in the assetType field.
Note:
If both currentOwner and assetIds are specified, both are validated. For example, consider user1 and user2 are owners of assetID1 and assetID2 respectively. In the request payload, if you include assetID1 and assetID2 in the assetIds field and user1 in the currentOwner field, then only assetID1 ownership changes.
*newOwner. Specifies the user name of the user who would be the new owner of the assets specified.
Example 1: If user1 owns two assets, an API petstore and application app1, and you want the ownership to be transferred to user2, send a REST request as follows:
POST http://localhost:5555/rest/apigateway/assets/owner
Content-Type: application/json
{
"assetType": "*", (API/APPLICATION)

"currentOwner": "user1",

"newOwner": "user2"
}
This request transfers the ownership of all the assets owned by user1 to user2.
The change approval process is initiated.
Example 2: user1 owns three APIs, api1, api2, and api3 and 2 applications, app1 and app2. If you want the ownership of api1, api2, and app1 to be transferred to user2, send a REST request as follows:
POST http://localhost:5555/rest/apigateway/assets/owner
Content-Type: application/json
{
"assetType": "*", (API/APPLICATION)

"assetIds": ["apiID1, apiID2, appID1"],

"currentOwner": "user1",

"newOwner": "user2"
}
where apiID1, apiID2, and appID1 are asset IDs of api1, api2, and app1 respectively.
The change approval process is initiated.
Note:
If the approval flow is not configured, the ownership of the assets changes from user1 to user2. Skip to step 4.
2. An approval request is sent to the approver.
The approval request contains information of all the assets whose ownership needs to change and the new owners' name.
3. The approver approves the request in the Pending Requests section of the API Gateway UI.
The approval notification is sent to the requester.
4. The owner of the assets is changed from user1 to user2.