Services querying - sonata-nfv/tng-gtk-common GitHub Wiki
This wiki page is part of the usage documentation of the tng-gtk-common
module.
Context
Services are are on-boarded within packages (see Packages management), so one can only GET
or OPTIONS
them, and not POST
, PUT
, PATCH
or DELETE
.
Querying a specific service
A specific service's metadata can be fetched using the following command:
$ curl :api_root/services/:service_uuid
Expected returned data is:
HTTP
code200
(Ok
) if the service is found, with the service's metadata in the body (JSON
format);HTTP
code400
(Bad Request
), if the:service_uuid
is mal-formed;HTTP
code404
(Not Found
), if the service is not found.
Querying several services
Querying all existing services can be done using the following command (default values for DEFAULT_PAGE_SIZE
and DEFAULT_PAGE_NUMBER
mentioned above are used):
$ curl :api_root/services
If different default values for the starting page number and the number of records per page are needed, these can be used as query parameters:
$ curl ":api_root/services?page_size=20&page_number=2"
Note the ""
used around the command, in order for the shell
used to consider the &
as part of the command, instead of considering it a background process command.
Expected returned data is:
HTTP
code200
(Ok
) with an array of services' metadata in the body (JSON
format), or an empty array ([]
) if none is found according to the parameters passed;
Options
We may query which operations are allowed with the HTTP
verb OPTIONS
, by issuing the following command:
$ curl -X OPTIONS :api_root/services
HTTP
code200
(Ok
) if the services options are defined;