kibana/docs/api/synthetics/private-locations/get-private-locations.asciidoc
Shahzad d2a54d9180
[Synthetics] Private location public API's (#169376)
Co-authored-by: Abdul Wahab Zahid <awahab07@yahoo.com>
Co-authored-by: Justin Kambic <jk@elastic.co>
2023-11-06 12:29:27 -05:00

98 lines
3.1 KiB
Text

[[get-private-locations-api]]
== Get Private Locations API
++++
<titleabbrev>Get Private Locations</titleabbrev>
++++
Retrieves a list of private locations or a single private location by ID.
=== {api-request-title}
`GET <kibana host>:<port>/api/synthetics/private_locations`
`GET <kibana host>:<port>/s/<space_id>/api/synthetics/private_locations`
=== {api-prereq-title}
You must have `read` privileges for the *Synthetics and Uptime* feature in the *{observability}* section of the
<<kibana-feature-privileges,{kib} feature privileges>>.
[[private-locations-list-response-example]]
==== List Response Example
The API returns a JSON array of private locations when accessing the list endpoint, with each private location having the following attributes:
- `label` (string): A label for the private location.
- `id` (string): The unique identifier of the private location.
- `agentPolicyId` (string): The ID of the agent policy associated with the private location.
- `isInvalid` (boolean): Indicates whether the location is invalid. If `true`, the location is invalid, which means the agent policy associated with the location is deleted.
- `geo` (object): Geographic coordinates for the location, including `lat` and `lon`.
- `namespace` (string): The namespace of the location, which is the same as the namespace of the agent policy associated with the location.
Here's an example list response:
[source,json]
--------------------------------------------------
[
{
"label": "Test private location",
"id": "fleet-server-policy",
"agentPolicyId": "fleet-server-policy",
"isInvalid": false,
"geo": {
"lat": 0,
"lon": 0
},
"namespace": "default"
},
{
"label": "Test private location 2",
"id": "691225b0-6ced-11ee-8f5a-376306ee85ae",
"agentPolicyId": "691225b0-6ced-11ee-8f5a-376306ee85ae",
"isInvalid": false,
"geo": {
"lat": 0,
"lon": 0
},
"namespace": "test"
}
]
--------------------------------------------------
[[private-location-by-id-response-example]]
==== Get by ID/Label Response Example
The API returns a JSON object of a single private location when accessing the endpoint with a specific `id`, with the same attributes as in the list response.
Here's an example request for a single location by ID:
[source,sh]
--------------------------------------------------
GET api/synthetics/private_locations/<location_id>
--------------------------------------------------
or by label:
[source,sh]
--------------------------------------------------
GET api/synthetics/private_locations/<Location label>
--------------------------------------------------
Here's an example response object:
[source,json]
--------------------------------------------------
{
"label": "Test private location",
"id": "test-private-location-id",
"agentPolicyId": "test-private-location-id",
"isServiceManaged": false,
"isInvalid": false,
"geo": {
"lat": 0,
"lon": 0
},
"namespace": "default"
}
--------------------------------------------------