---
title: LocationsApi
---
## PureCloud::LocationsApi
All URIs are relative to *https://api.mypurecloud.com*
Method | HTTP request | Description
------------- | ------------- | -------------
|[**get_location_id**](LocationsApi.html#get_location_id) | **GET** /api/v2/locations/{locationId} | Get Location by ID.|
|[**get_locations**](LocationsApi.html#get_locations) | **GET** /api/v2/locations | Get a list of all locations.|
|[**get_search**](LocationsApi.html#get_search) | **GET** /api/v2/locations/search | Search using q64|
|[**post_search**](LocationsApi.html#post_search) | **POST** /api/v2/locations/search | Search|
{: class="table table-striped"}
## -[**Location**](Location.html) get_location_id(location_id)
Get Location by ID.
### Example
~~~ruby
# load the gem
require 'purecloud'
# setup authorization
@secret = ENV['PURECLOUD_SECRET']
@id = ENV['PURECLOUD_CLIENT_ID']
environment = "mypurecloud.com"
@authToken = PureCloud.authenticate_with_client_credentials @id, @secret, environment
PureCloud.configure do |config|
config.access_token = @authToken
end
api_instance = PureCloud::LocationsApi.new
location_id = "location_id_example" # String | Location ID
begin
#Get Location by ID.
result = api_instance.get_location_id(location_id)
p result
rescue PureCloud::ApiError => e
puts "Exception when calling LocationsApi->get_location_id: #{e}"
end
~~~
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**location_id** | **String**| Location ID |
{: class="table table-striped"}
### Return type
[**Location**](Location.html)
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
## -[**Array<Location>**](Location.html) get_locations(opts)
Get a list of all locations.
### Example
~~~ruby
# load the gem
require 'purecloud'
# setup authorization
@secret = ENV['PURECLOUD_SECRET']
@id = ENV['PURECLOUD_CLIENT_ID']
environment = "mypurecloud.com"
@authToken = PureCloud.authenticate_with_client_credentials @id, @secret, environment
PureCloud.configure do |config|
config.access_token = @authToken
end
api_instance = PureCloud::LocationsApi.new
opts = {
page_size: 25, # Integer | Page size
page_number: 1, # Integer | Page number
sort_order: "sort_order_example" # String | Sort order
}
begin
#Get a list of all locations.
result = api_instance.get_locations(opts)
p result
rescue PureCloud::ApiError => e
puts "Exception when calling LocationsApi->get_locations: #{e}"
end
~~~
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**page_size** | **Integer**| Page size | [optional] [default to 25]
**page_number** | **Integer**| Page number | [optional] [default to 1]
**sort_order** | **String**| Sort order | [optional]
{: class="table table-striped"}
### Return type
[**Array<Location>**](Location.html)
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
## -[**GroupsSearchResponse**](GroupsSearchResponse.html) get_search(opts)
Search using q64
### Example
~~~ruby
# load the gem
require 'purecloud'
# setup authorization
@secret = ENV['PURECLOUD_SECRET']
@id = ENV['PURECLOUD_CLIENT_ID']
environment = "mypurecloud.com"
@authToken = PureCloud.authenticate_with_client_credentials @id, @secret, environment
PureCloud.configure do |config|
config.access_token = @authToken
end
api_instance = PureCloud::LocationsApi.new
opts = {
q64: "q64_example", # String |
expand: ["expand_example"] # Array |
}
begin
#Search using q64
result = api_instance.get_search(opts)
p result
rescue PureCloud::ApiError => e
puts "Exception when calling LocationsApi->get_search: #{e}"
end
~~~
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**q64** | **String**| | [optional]
**expand** | [**Array<String>**](String.html)| | [optional]
{: class="table table-striped"}
### Return type
[**GroupsSearchResponse**](GroupsSearchResponse.html)
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
## -[**GroupsSearchResponse**](GroupsSearchResponse.html) post_search(opts)
Search
### Example
~~~ruby
# load the gem
require 'purecloud'
# setup authorization
@secret = ENV['PURECLOUD_SECRET']
@id = ENV['PURECLOUD_CLIENT_ID']
environment = "mypurecloud.com"
@authToken = PureCloud.authenticate_with_client_credentials @id, @secret, environment
PureCloud.configure do |config|
config.access_token = @authToken
end
api_instance = PureCloud::LocationsApi.new
opts = {
body: PureCloud::SearchRequest.new # SearchRequest | Search request options
}
begin
#Search
result = api_instance.post_search(opts)
p result
rescue PureCloud::ApiError => e
puts "Exception when calling LocationsApi->post_search: #{e}"
end
~~~
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | [**SearchRequest**](SearchRequest.html)| Search request options | [optional]
{: class="table table-striped"}
### Return type
[**GroupsSearchResponse**](GroupsSearchResponse.html)
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json