Creating An Entity
To create an entity, we need to make the following HTTP request:

Request

1
POST /api/v1/{entity-type}/invite
Copied!
Field
In
Type
Description
content-type
header
string
Set to application/json
authorization
header
string
Set to bearer {access-token}
entity-type
path
string
The type of entity to create
...
body
object
The entity's data

Response

This will store the entity in the registry and return the following object:
1
{
2
"id": "open-saber.registry.invite",
3
"ver": "1.0",
4
"ets": 1634198998956,
5
"params": {
6
"resmsgid": "",
7
"msgid": "3ee6a76f-d6c8-4262-a7ee-ddbe66fcb127",
8
"err": "",
9
"status": "SUCCESSFUL",
10
"errmsg": ""
11
},
12
"responseCode": "OK",
13
"result": { "Teacher": { "osid": "1-9d6099fc-2c01-4714-bceb-55ff28c482f9" } }
14
}
Copied!
Important variables in the response body:
Field
In
Type
Description
result.{entity-type}.osid
body
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

1
curl --location \
2
--request 'POST' \
3
--header 'content-type: application/json' \
4
--data-raw '{
5
...claims
6
}' \
7
'{registry-url}/api/v1/{entity-type}/invite'
Copied!

HTTPie

1
echo '{
2
...claims
3
}' | http post \
4
'{registry-url}/api/v1/{entity-type}/invite' \
5
'content-type: application/json'
Copied!
{registry-url} is usually http://localhost:{port}. The port can be found under the rg section in the docker-compose.yaml file and is usually 8081.
Last modified 8d ago
Copy link
Edit on GitHub