CommunicationParty API
The intended use for this API is to get a local copy of communication parties in the Addressregistry (AR), and to keep this copy up to date.
First the /CommunicationPartyExport endpoint can be used to get a full export of all active communication parties, and then use /CommunicationPartyEvents to get updates on the parties.
The events endpoint contains CommunicationParty.Updated
and CommunicationParty.Created
events. Each event contains a communication party object. See details below.
Auth
Some parts of the API are restricted, and require authorization. See the Auth page for more information.
Environments
Environment | URL |
---|---|
Test | cpe.test.grunndata.nhn.no |
Production | cpe.grunndata.nhn.no |
Swagger
Environment | URL |
---|---|
Test | cpe.test.grunndata.nhn.no/swagger |
Production | cpe.grunndata.nhn.no/swagger |
Endpoints
HTTP Method | Endpoint | Description |
---|---|---|
GET | /CommunicationPartyExport | Get full export of all active communication parties |
GET | /CommunicationPartyEvents | Get events |
GET /CommunicationPartyExport
Get a full export of all CommunicationParties. Returns streamed JSON data.
Example
Get export
GET /CommunicationPartyExport
Response
The response contains an updated list of all active communicationparties in the AddressRegistry.
LastDateTimeOffset
and LastEventId
contains the datetimeoffset and eventID of the last update included in the export. These can be used as parameters in the events endpoint to get the updates that has happened since the full export was gathered.
{
"LastDateTimeOffset": "datetimeoffset",
"LastEventId": "string",
"CommunicationParties": [
{
"object"
}
]
}
GET /CommunicationPartyEvents
Get CommunicationParty events based on given parameters. The number of events varies, but getting updates once every hour should be sufficient.
NB: The value in fromDatetime
needs to be URL Encoded.
Path parameters
Parameter | Type | Description |
---|---|---|
eventId |
string | The id of the first event from where to start the search |
fromDatetime |
string | The datetimestamp of the event from where to get events from |
Size |
int | The size of the page |
Example
Get all events
GET /CommunicationPartyEvents
Get events from a given id
GET /CommunicationPartyEvents?EventId=ddcae29a-68bc-40f9-854d-bad97d784a04
Get events from a given datetime Datetime format needs to be yyyy-mm-ddTHH:mm:ss.fffzzz (2023-07-10T16:00:00.000+02:00) and the value needs to be urlencoded
GET /CommunicationPartyEvents?FromDatetime=2023-06-07T07%3A11%3A25.000%2B02%3A00
Get events from a given datetime with a given number of objects in the response
GET /CommunicationPartyEvents?FromDatetime=2023-06-07T07%3A11%3A25.000%2B02%3A00&Size=1
Response
The response returns a link Next
that contains a url with the eventid of the last event in the response.
This is for quering the next page of events. The first event in the response from the Next
link query will be the last event in the previous query.
{
"communicationParties": [
{
"EventId": "string",
"FromDatetime": "datetimeoffset",
"HerId": "int",
"OrgNr": "int",
"EventType": "string",
"CommunicationParty": "object"
}
],
"_Links": {
"next": {
"href": "string"
}
}
}
CommunicationParty objects
The CommunicationParty objects are based on the contracts found here.
There are some minor changes from these contracts:
People
andServices
objects will always be null. The objects will excist on their own, with parent data populated. If an update happens on an organization that affects the underlying services and organization people, an event will be created for each of the underlying communication parties as well.- In the
Person
objectCitizenID
is set to null, and inPerson:HPRInformation
the objectsAuthorizations
andSpecialCompetences
is set to null. If this information is needed it should be gathered from the Health Personell Registry - HPR.