COmanage Registry CORE API serves as a central hub for API management, ensuring proper validation, seamless interaction with other system models, efficient data processing, and maintaining overall data integrity. This recipe describes how COmanage Registry might be configured with CORE API to manage CoPerson records.
Recipe Ingredients
- This recipe requires COmanage Registry version 4.0.0 or later.
- Install Plugins
Install the CORE API Plugin - Configure API User
Configure an API User - Configure CORE API
Configure CORE API - GET/Read CoPerson
Fetch a CoPerson and its associated data - PUT/Update CoPerson
Update a CoPerson
Like what you see? See our other recipes!
Recipe Steps
1. Install Plugins
COmanage Registry supports several types of plugins in order to easily customize and extend Registry functionality. Plugins may be one of three types, each of which has a different process for being installed and enabled: Supported Core Plugins, Supported Non-core Plugins, and External Plugins.
2. Configure API User
3. Configure CORE API
All plugins have basic settings that are are related to the plugin’s Class. In addition, some plugins have plugin-specific settings to configure the specifics related to the plugin.
4. GET/Read CO Person
Step overview
The CORE API GET request aims to retrieve detailed information about a CoPerson from the COmanage registry database, identified by a unique identifier within the URL. The information is obtained in JSON format.
Sample request:
curl -X GET "https://example.com/registry/api/co/2/core/v1/people/650bf0892fe9c579f6e38716c66a0558f859b1b04964f15d1b1fecbcc80d3bfc@example.org" \ -H "Cache-Control: no-cache" \ -H "Accept: application/json" \ -H "Authorization: Basic $(echo -n 'apiuser_test:apiuser_test_pass' | base64)"
Main Components:
Host ({{host}}): The base URL or domain where the API is hosted. Replace {{host}} with the actual domain.
Unique Identifier ({uniqueIdentifier}): A unique string identifying the person in the registry. This is embedded within the URL.
Credentials: {{apiuser_test}}:{{apiuser_test_pass}} are placeholders for the API user's username and password. These should be replaced with actual credentials and encoded in Base64 for the Authorization header.
JSON Response:
5. PUT/Update CO Person
Step overview
The CORE API PUT request aims to update the information about a CoPerson from the COmanage registry database, identified by a unique identifier within the URL. The request payload has to be in JSON format.
Sample request:
curl -X PUT "https://example_incommon.com/registry/api/co/2/core/v1/people/650bf0892fe9c579f6e38716c66a0558f859b1b04964f15d1b1fecbcc80d3bfc@example.org" \ -H "Cache-Control: no-cache" \ -H "Accept: application/json" \ -H "Content-Type: application/json; charset=utf-8" \ -H "Authorization: Basic $(echo -n 'apiuser_test:apiuser_test_pass' | base64)" \ -d '{}'
Main Components:
- Host Placeholder ({{host}}): The base URL or domain where the API is hosted. Replace {{host}} with the actual domain.
- Unique Identifier ({uniqueIdentifier}): A unique string that identifies the person in the registry. This identifier is embedded within the URL.
- Credentials: {{apiuser_test}}:{{apiuser_test_pass}} are placeholders for the API user's username and password. These should be replaced with actual credentials and encoded in Base64 for the Authorization header.
For a PUT/Update request each record MUST include a meta
JSON object with the id
of the record. The rest of the `meta` fields returned from the READ action will be ignored.
5.1 Update CoPerson's existing Email Address
Below we aim to modify the email type attribute of a "CoPerson" entity in COmanage Registry. Initially, the email type is official
and we want to update it to personal
. The body of the request will be as presented below:
- We will include the entire response as received from the GET request
- We will strip out all the metadata fields except from the
id
- We will update the value according to our use case
Old Email Type value: official | Updated Email Type value: personal |
---|
5.2 Add a new Email Address to CoPerson
Below we aim to add one more email, of type personal, to the CoPerson
. The body of the request will be as presented below:
- We will include the entire response as received from the GET request
- We will strip out all the metadata fields except from the
id
- We will append a new JSON object in the `EmailAddress` array. The object will include all the required data. Check Email Address Schema for more details.