Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

...

...

...

...

...

...

...

General Information

...

ServiceAPIMethodData ModelWorkflow
urac

/admin/

inviteUsers
POST

Data Model: Users

users/invite

PUTUsers 

Description

For each user you sent the following happens:

  • Get the user by id or email or username where status is active
  • if not found add it to failed array in response
  • if found continue with the following steps:
    •  check if already invited to this tenant
    • if yes push user to failed array response with reason "User has already been invited."
    • if no, generate pin if code is set to yes 
      • if failed to generate pin push user to failed array response with reason "Failed to generate pin at this."
    • invite the user by updating its allowedTenants
    • send an email to the user with the generated pin 

Input

...

Type: application/json
NameSourceMandatoryTypeSpecial Format
Description
users
body
Body
YesemailNOStringN/Athe user email (either username or email should be provided)groups
YESArray
array of objectsarray of users to be invitesusernameNOStringN/Athe user username (either username or email should be provided)
includes user object, groups array, and pin object



NameSourceMandatoryTypeSpecial FormatDescription
groupsBodyNOArrayArray of stringsGroups array
pinBodyNOObjectincludes code and allowed parametersPin Object



NameMandatoryTypeDescription
codeYESBooleanset to True to create a random generated code 
allowedYESBoolean

set to True if this user is allowed to start pin code login, and also it will be set to main tenant


userBodyYESObjectIncludes one of id, username, or emailUser Object

One of the following should exist under the user object:


NameMandatoryTypeSpecial FormatDescription
idYESStringN/AUser ID
usernameYESStringN/AUsername
emailYESStringN/AUser Email




Output

...

Response

SOAJS has a unified response. Check out this link to understand more the schema of SOAJS response 

Valid Response

Code Block
languagejs
titleValid Response Sample
linenumberstrue
collapsetrue
{ 	"
  result": true,
	"  data": { 
		"..."	
	succeeded: [ { id: '%user_id%' } ],
  	failed: [] 
  }
}

Invalid Response


Code Block
languagejs
titleError Valid Failed Response Sample
linenumberstrue
collapsetrue
{
    "resultsucceeded":false [],

   "errorsfailed":{ [
    {
      "codesid":[411] "%user_id%",
        "detailsreason":[ "User has already been invited."
    },
	{
 {     "id": "%user_id%",
      "reason": "User is already in the tenant "code":411tenancy."
    },
	{
      "id": "%user_id%",
       "messagereason": "invalid user id provided"Failed to generate pin at this."
    },
	{
      "id": "%user_id%",
       }
        ]"reason": "Cannot invite a user without providing its id or username."
    }
  ]
}

...

Invalid Response

...

Code Block

...

Request

Code Block
languagebash
titleCalling Get User API
 > CURL -X POST http://127.0.0.1:4000/urac/admin/inviteUsers --data '{"users": 
	[
		{
			username: "username",
			email: "email@email.com",
			pin : {
					code: true,
					allowed: true,
					}
			groups : ["group"]
		}
	]
}'

Response

{
Code Block
languagejs
titleGet User API response
language

...

js
titleError Response Sample
linenumberstrue
collapsetrue
{
    "result":false,
    "errors":{
        "codes":[602],
        "details":[
            {
                "resultcode": true,602,
                "datamessage":"Model [{
		username: "username",
		email: "email@email.com"
	}]
}error: + %model_error%"
            }
        ]
    }
}

Response validation

NameMandatoryTypeSpecial FormatDescription
succeededYESArrayArray of ObjectsSucceeded response information

One of the following should exist under the succeeded object:


NameMandatoryTypeSpecial FormatDescription
idYESStringN/AUser ID
usernameYESStringN/AUsername
emailYESStringN/AUser Email


failedYESStringN/AFailed response information



NameMandatoryTypeSpecial FormatDescription
reasonYESStringN/AFailing reason

One of the following should exist also under the succeeded object:


NameMandatoryTypeSpecial FormatDescription
idYESStringN/AUser ID
usernameYESStringN/AUsername
emailYESStringN/AUser Email




Response schema

Follow this link to check out the response JSON Schema


SOAJS Error Codes



Code
Description
400

Business logic required data are missing

520

Unable to find user

602Model error: + %model_error%