Instances
URL Endpoint
HTTPS://api.adaptiveplanning.com/api/rest/security/<version>/<tenant>/users/instances
Version: v1
Category | Data Update |
Description | Assign users to instances when using Adaptive Planning multi-instances in a parent-child hierarchy. |
Permissions Required To Invoke | Admin access > Users |
The Multi-instance User Access API enables you to retrieve and change instance assignments for a user.
Supported HTTPS VERBs:
HTTP Verb | Single Resource | Collection Resource | Description |
|---|---|---|---|
GET | Not Supported | Supported | Retrieves all the instance assignments of users, including their default instance assignment. |
PATCH | Supported | Not Supported | Adds a new instance to the instance assignment of an existing user. |
PUT | Supported | Not Supported | Updates and replaces existing instances assigned to a user with the specified data in the request body. |
GET
- Request:
- /users/instances:Retrieves a collection of instances assigned to users.Retrieves all the instance assignments of users, including their default instance assignment. You can filter by instanceCode. Pagination uses the default values for limit or offset if these query parameters are missing.Sample Request URIHTTPS://api.adaptiveplanning.com/api/rest/security/v1/default/users/instances?offset=5&limit=5Sample Request Header:Accept-Language: enSample Request BodyQuery ParametersNameDescriptionRequiredinstanceCodeThe unique identifier of an instance defining the instance context to retrieve the list of users for that instance. If an instance code isn’t specified, all users from the default instance of the API caller are retrieved.NlimitThe maximum number of objects in a single response. The default is 500. The maximum is 500.NoffsetThe zero-based index of the first user in a response collection. The default is 0.Use offset with the limit parameter to control paging of a response collection.N
- Sample Response
- 200Successful ResponseSample Response{ "links": { "next": "https://api.adaptiveplanning.com/api/rest/security/v1/default/users/instances?offset=10&limit=5", "previous": "https://api.adaptiveplanning.com/api/rest/security/v1/default/users/instances?offset=0&limit=5" }, "total": 26, "users": [ { "userGuid": "111SampleUserGuid", "userName": "sampleuser1@company.com", "wid" : "14400000000000000000000000000samplewid", "instances": [ { "code": "sampleCompany", "default": true } ] }, { "userGuid": "222SampleUserGuid", "userName": "sampleuser2@company.com", "wid" : "31100000000000000000000000000samplewid", "instances": [ { "code": "sampleCompany", "default": true } ] }, { "userGuid": "474C4F424F0000000000000001sampleGuid", "userName": "sampleuser3@company.com", "wid" : "34400000000000000000000000000samplewid", "instances": [ { "code": "sampleCompany", "default": true } ] }, { "userGuid": "111C4F424F0000000000000001sampleGuid", "userName": "sampleuser5@company.com", "wid" : "343400000000000000000000000000samplewid", "instances": [ { "code": "sampleCompany", "default": true } ] }, { "userGuid": "374C4F424F0000000000sampleGuid", "userName": "sampleuser4@company.com, ""wid" : "355000000000000000000000000samplewid", "instances": [ { "code": "sampleCompany_Child1" }, { "code": "sampleCompany_Child2" }, { "code": "sampleCompany", "default": true } ] } ] }
PATCH:
- Request:
- users/instances?instanceCode={INSTANCECODE}:Partially updates the instance assignment of an existing user.Adds a new instance to the instance assignment of an existing user. If you specify the default attribute for an instance, it replaces the current default instance assignment of the user.Specify a user identifier in the userIdentifier query parameter.In the request body, specify a userIdentifier.Sample Request URIHTTPS://api.adaptiveplanning.com/api/rest/security/v1/default/users/instances?userIdentifier=userNameSample Request BodySample PATCH Request Body{ "userName": "SampleUser1@SampleCompany.com", "instances": [ { "code": "SampleCompany" }, { "code": "SampleCompany_Child", "default": true } ] }Query ParametersNameDescriptionRequiredinstanceCodeAn instance code which is higher in the same instance hierarchy as the instance being added for an existing user. Only users with access to the higher-level parent instance can add child instances.NuserIdentifierA userIdentifier is used to determine the unique Adaptive Planning user. Possible values: userName, wid, userGuid.YRequest HeaderContent Typeapplication/jsonAuthorizationBasic or token basedPayload ParametersNameDescriptionRequiredwidThe Workday ID of a user.NuserNameThe username (login name) of a user.NuserGuidThe Global unique user identifier, system-assigned at user creation.Ninstance CodeAn instanceCode of company to be assigned to a user in the Payload.YdefaultThe default instanceCode assigned to a user in the Payload.N
PUT:
- Request:
- users/instances:Updates & replaces existing instances assigned to a userUpdates an existing instance assigned to a user with the specified userIdentifier. Replaces instances assigned to the user with specified data in the request body.
- If an instance assignment isn't a part of existing instances assigned to a user, adds the instance.
- If an instance assignment isn't a part of the request body, access to the instance is removed if it existed previously.
- Specify a user identifier in the userIdentifier query parameter.
- Specify an instance code in the instanceCode query parameter as needed.
- A user identifier in the userIdentifier query parameter.
- In the request body, specify these required fields: <userIdentifier> (Username, WID or userGUID). <userIdentifier> is the value you specified in the userIdentifier query parameter.
- If you specify the default attribute for an instance, replaces the current default instance for the user.
Sample Request URIHTTPS://api.adaptiveinsights.com/api/rest/security/v{1}/{default}/users/instances?userIdentifier=userNameSample Request BodySample PUT Request Body{ "userName": "sampleUser@SampleCompanyParent.com", "instances": [ { "code": "SampleCompanyParent" }, { "code": "SampleCompanyChild", "default": true }, { "code": "SampleCompanyGrandChild" } ] }Query ParametersNameDescriptionRequiredinstanceCodeAn instance code which is higher in the same instance hierarchy as the instance being added for an existing user. Only users with access to the higher-level parent instance can add child instances.NuserIdentifierA userIdentifier is used to determine the unique Adaptive Planning user. Possible values: userName, wid, userGuid.YRequest HeaderContent Typeapplication/jsonAuthorizationBasic or token basedPayload ParametersNameDescriptionRequiredwidThe Workday ID of a user.NuserNameThe username (login name) of a user.NuserGuidThe Global unique user identifier, system-assigned at user creation.Ninstance CodeAn instanceCode of company to be assigned to a user in the Payload.YdefaultThe default instanceCode assigned to a user in the Payload.NResponses - Responses
- List of status codes supported:200Successful response.Example ResponseSample 200 Successful PATCH Response{ "userName": "SampleUser@SampleComopany.com", "instances": [ { "code": "SampleCompany" }, { "code": "SampleCompany_Child1", "default": true } ] }500Internal Server ErrorExample: If User invalid.Sample 500 Response{ "status": { "errorMessage": "User with username user@samplecompany.com does not exists in company SampleCompany. " }, "userName": "user@samplecompany.com" }Example: if invalid instanceCodeSample 500 Response{ "userName": "user@samplecompany.com", "instances": [ { "status": { "errorMessage": "SampleOtherCompany not in SampleCompany network. API Caller: APICaller@samplecompany.com not authorized to assign user: user@samplecompany.com to Instance: SampleOtherCompany " }, "code": "SampleCompany", "default": true }, { "code": "SAMPLECOMPANY_CHILD2" } ] }405Invalid Resource or operation403User has insufficient permissions404Resource not found.