Metadata services
Every Security Server has ready-made services that answer the questions "who is there, what do they offer, and what is open to me". There is no need to register separately or obtain access rights. You ask all of them through your own Security Server.
| Service | What it returns |
|---|---|
listClients | All members and subsystems of the instance |
listMethods | All REST services published by one subsystem |
allowedMethods | Those of them that are open to you |
getOpenAPI | The OpenAPI description of a REST service |
getWsdl | The WSDL of a SOAP service |
listClients
curl -H "Accept: application/json" "http://ss.example.internal:8080/listClients"{
"member": [
{
"id": { "object_type": "MEMBER", "xroad_instance": "GRG", "member_class": "GOV", "member_code": "7654321" },
"name": "Example organisation"
},
{
"id": { "object_type": "SUBSYSTEM", "xroad_instance": "GRG", "member_class": "GOV", "member_code": "7654321", "subsystem_code": "LAVLAGAA" },
"name": "Example organisation"
}
]
}Without an Accept header, XML is returned. X-Road-Client is not required.
listMethods
The REST services published by a provider subsystem:
curl -H "X-Road-Client: GRG/COM/1234567/ZEEL" \
"http://ss.example.internal:8080/r1/GRG/GOV/7654321/LAVLAGAA/listMethods"{
"service": [
{
"object_type": "SERVICE",
"xroad_instance": "GRG",
"member_class": "GOV",
"member_code": "7654321",
"subsystem_code": "LAVLAGAA",
"service_code": "orlogo",
"service_type": "OPENAPI",
"endpoint_list": [
{ "method": "GET", "path": "/v1/citizens/*" }
]
}
]
}To get the list of SOAP services, use a SOAP-format listMethods request (serviceCode = listMethods inside xrd:service).
allowedMethods
It has exactly the same format as listMethods, but returns only the services to which the subsystem named in X-Road-Client has been granted access.
curl -H "X-Road-Client: GRG/COM/1234567/ZEEL" \
"http://ss.example.internal:8080/r1/GRG/GOV/7654321/LAVLAGAA/allowedMethods"When a call returns AccessDenied, check this first. If the service is not in the list, the problem is not in your code but in the access rights.
getOpenAPI
curl -H "X-Road-Client: GRG/COM/1234567/ZEEL" \
"http://ss.example.internal:8080/r1/GRG/GOV/7654321/LAVLAGAA/getOpenAPI?serviceCode=orlogo"This works only when the provider has registered the service with an OpenAPI 3 description. You can generate client code from the returned description. Do not use the servers address in the description: always send your requests through your own Security Server.
getWsdl
curl "http://ss.example.internal:8080/wsdl?xRoadInstance=GRG&memberClass=GOV&memberCode=7654321&subsystemCode=LAVLAGAA&serviceCode=orlogo&version=v1"version is needed only when the service is registered with a version.
When to use them
- During development: instead of guessing the service code and path, read them from
listMethodsandgetOpenAPI. - When troubleshooting:
allowedMethodstells you directly about access rights, andlistClientstells you whether an identifier is correct. - In a running system: do not query before every call. Cache the response, or use it only for diagnostics.
Source documents: Service Metadata Protocol for REST, Service Metadata Protocol