Retrieving An Entity

Request

To retrieve an entity, we need to make the following HTTP request:
1
GET /api/v1/{entity-type}/{id} HTTP/1.1
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 retrieve
id
path
string
The ID of the entity to retrieve

Response

This will return the entity's JSON representation as follows:
1
{
2
"phoneNumber": "1234567890",
3
"school": "UP Public School",
4
"subject": "Math",
5
"name": "Pranav Agate",
6
"osid": "{id}",
7
"osOwner": ["{owner-id}"],
8
"_osState/school": "DRAFT"
9
}
Copied!
Important variables in the response body:
Field
In
Type
Description
osOwner
body
string
User ID of the entity in Keycloak.
_osState/{field}
body
string
State of an attestable field. Can be DRAFT (when it has not been sent for attestation), ATTESTATION_REQUESTED (when sent for attestation), PUBLISHED (when successfully attested) and REJECTED (when rejected by the attestor)

Usage

cURL

1
curl --location \
2
--request GET \
3
--header 'content-type: application/json' \
4
--header 'authorization: bearer {access-token}' \
5
'{registry-url}/api/v1/{entity-type}/{id}'
Copied!

HTTPie

1
http get \
2
'{registry-url}/api/v1/{entity-type}/{id}' \
3
'authorization: bearer {access-token}'
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