Using system account credentials

It is possible to interact with Ontoserver’s API rather than using user interface tools like Snapper.

Ontoserver supports:

A client credentials token is necessary to obtain to authenticate with Ontoserver.

A tool free tool like Postman can be used to obtain tokens and issue requests, or they can be issued on the command line like in these examples:

Request Token

curl –location –request POST ‘<!– AUTHENTICATION URL –><!–PORT–>/auth/realms/nhs-digital-terminology/protocol/openid-connect/token‘ \
–header ‘Content-Type: application/x-www-form-urlencoded’ \
–data-urlencode ‘grant_type=client_credentials’ \
–data-urlencode ‘client_id=<!– CLIENT ID –>’ \
–data-urlencode ‘client_secret=<!– CLIENT SECRET –>’

Retrieve CodeSystem with ID a3a0f873-4529-4516-87a7-e3ecd9c9952e

curl –location –request GET ‘<!– ONTOSERVER URL –><!–PORT–>/fhir/CodeSystem/a3a0f873-4529-4516-87a7-e3ecd9c9952e‘ \
–header ‘Authorization: Bearer <!– TOKEN –>’ 

Update CodeSystem with ID

curl –location –request PUT ‘<!– ONTOSERVER URL –><!–PORT–>/fhir/CodeSystem/a3a0f873-4529-4516-87a7-e3ecd9c9952e‘ \
–header ‘Content-Type: application/fhir+json’ \
–header ‘Accept: application/fhir+json’ \
–header ‘Authorization: Bearer <!–TOKEN –>’ \
–data-raw ‘{
    “resourceType”: “CodeSystem”,
    “id”: “a3a0f873-4529-4516-87a7-e3ecd9c9952e”,

<!– rest of resource goes here .. removed for compactness –>


}’