Comment on page

Invite An Entity

To invite an entity, we need to make the following HTTP request
post
/api/v1/{entity-type}/invite
Invite an Entity
Parameters
Path
entity-type*
The type of entity to create
Header
content-type*
Set to application/json
authorization
Set to Bearer {access-token} if inviteRoles in schema config is not anonymous else this can be empty
Body
...*
Object
The entity's data
Responses
200: OK
Success response of entity invited
Important Fields in Response Body
Field
Type
Description
result.{entity-type}.osid
string
The ID of the create entity in the registry, used for retrieval and modification of the entity

Usage

So to create a Teacher entity named Pranav Agate who teaches Math at UP Public School, we would make the following API call:

cURL

curl --location \
--request 'POST' \
--header 'content-type: application/json' \
--data-raw '{
"phoneNumber": "1234567890",
"school": "UP Public School",
"subject": "Math",
"name": "Pranav Agate",
}' \
'{registry-url}/api/v1/Teacher/invite'

HTTPie

printf '{
"name": "Pranav Agate",
"teaches": "Math",
"school": "UP Public School"
}'| http POST '{registry-url}/api/v1/Teacher/invite' \
Content-Type:'application/json'
{registry-url} is usually http://localhost:{port}. The port can be found under the registry section in the docker-compose.yml file and is usually 8081.

Note: Invite API doesn't validate the required parameters. Invite API is designed to be used to invite another actor to the system with minimal information, hence required validations will not be applied. Instead, use create an entity API.