Publishing a service
To open your own service to other members, you register it on your Security Server and specify who may call it. The service itself stays in your internal network. It does not need to be exposed to the internet.
You do all the steps in the Security Server's admin UI.
1. Choose your subsystem
In the "Clients" section, open the subsystem that will own the service. If there is none, add a new one and register it.
We recommend creating a separate subsystem for each information system. Access rights are granted per subsystem, so this makes them easier to separate.
2. Add the service
In the subsystem's "Services" tab, choose the type:
| Type | What to enter |
|---|---|
| REST, with an OpenAPI 3 description | The URL of the description and the service code. The paths are read automatically. |
| REST, without a description | The base URL of the service and the service code |
| SOAP | The URL of the WSDL. The services are read from the WSDL. |
Where possible, register with an OpenAPI description. Consumers will then be able to download the description themselves with getOpenAPI and you will be able to grant access rights for each path.
3. Service settings
| Setting | Value |
|---|---|
| Service URL | The internal address of the service. The Security Server forwards the request here. |
| Timeout | How long to wait for a response (seconds) |
| Verify TLS certificate | Whether to verify the certificate if the service uses HTTPS |
After configuring it, enable the service.
The consumer's request path is appended to the Service URL:
Consumer: …/r1/GRG/GOV/7654321/LAVLAGAA/orlogo/v1/citizens/AA00112233
Service URL: http://app.example.internal:9000/api
Your system: http://app.example.internal:9000/api/v1/citizens/AA001122334. Grant access rights
In the "Access rights" section, add the subsystems that may call the service.
If you grant no access rights, nobody can call the service
Being a registered member is not enough. For each service, you specify individually who may access it. A consumer that is not in the list receives an AccessDenied error.
You can also grant access rights separately for specific paths within a single service (REST endpoint-level access rights).
5. Test
Send a test request from the consumer side. Every message is recorded on both parties' Security Servers.
To test without another member, you can grant access rights to another subsystem of your own and call through your own Security Server.
What your system will receive
When the Security Server forwards a request to your service, it carries the consumer's information in headers:
| Header | Value |
|---|---|
X-Road-Client | The calling subsystem. The Security Server has already checked access rights. |
X-Road-Id | The request identifier. Store it in your log. |
X-Road-UserId, X-Road-Issue | If the consumer supplied them |
For you to be able to trust these headers, your service must accept requests only from the Security Server. Connection, TLS, ports
Things to note
- The service code must be stable. Consumers write the code into their addresses, so if you change it their systems will break.
- Put the version in the path. For example
/v1/.... When you release a new version, leave the old one in place for a while. - Personal data. Make sure what you open to whom complies with the law and with your agreements. X-Road only transports the data, and the decision lies with the owner.
Continued: API design recommendations.