Locations
Create Location
Creates a new location.
POST
/
locations
Create Location
curl --request POST \
--url https://api.roostedhr.com/api/1_12/locations \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--data '
{
"location": "Henry Park",
"address": "1325 S Ellis St, Wichita, KS 67211, USA",
"city": "Wichita",
"zip": "67211",
"color": "#DC136C",
"location_comments": "",
"timezone_id": 4,
"default_clients_id": "hAjwQ",
"default_areas": []
}
'import requests
url = "https://api.roostedhr.com/api/1_12/locations"
payload = {
"location": "Henry Park",
"address": "1325 S Ellis St, Wichita, KS 67211, USA",
"city": "Wichita",
"zip": "67211",
"color": "#DC136C",
"location_comments": "",
"timezone_id": 4,
"default_clients_id": "hAjwQ",
"default_areas": []
}
headers = {
"X-API-KEY": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-KEY': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
location: 'Henry Park',
address: '1325 S Ellis St, Wichita, KS 67211, USA',
city: 'Wichita',
zip: '67211',
color: '#DC136C',
location_comments: '',
timezone_id: 4,
default_clients_id: 'hAjwQ',
default_areas: []
})
};
fetch('https://api.roostedhr.com/api/1_12/locations', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.roostedhr.com/api/1_12/locations",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'location' => 'Henry Park',
'address' => '1325 S Ellis St, Wichita, KS 67211, USA',
'city' => 'Wichita',
'zip' => '67211',
'color' => '#DC136C',
'location_comments' => '',
'timezone_id' => 4,
'default_clients_id' => 'hAjwQ',
'default_areas' => [
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-KEY: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.roostedhr.com/api/1_12/locations"
payload := strings.NewReader("{\n \"location\": \"Henry Park\",\n \"address\": \"1325 S Ellis St, Wichita, KS 67211, USA\",\n \"city\": \"Wichita\",\n \"zip\": \"67211\",\n \"color\": \"#DC136C\",\n \"location_comments\": \"\",\n \"timezone_id\": 4,\n \"default_clients_id\": \"hAjwQ\",\n \"default_areas\": []\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-KEY", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.roostedhr.com/api/1_12/locations")
.header("X-API-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"location\": \"Henry Park\",\n \"address\": \"1325 S Ellis St, Wichita, KS 67211, USA\",\n \"city\": \"Wichita\",\n \"zip\": \"67211\",\n \"color\": \"#DC136C\",\n \"location_comments\": \"\",\n \"timezone_id\": 4,\n \"default_clients_id\": \"hAjwQ\",\n \"default_areas\": []\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.roostedhr.com/api/1_12/locations")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-KEY"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"location\": \"Henry Park\",\n \"address\": \"1325 S Ellis St, Wichita, KS 67211, USA\",\n \"city\": \"Wichita\",\n \"zip\": \"67211\",\n \"color\": \"#DC136C\",\n \"location_comments\": \"\",\n \"timezone_id\": 4,\n \"default_clients_id\": \"hAjwQ\",\n \"default_areas\": []\n}"
response = http.request(request)
puts response.read_body{
"id": "78590",
"location": "Henry Park",
"addy_street_number": "1325 S Ellis St, Wichita, KS 67211, USA",
"addy_city": "Wichita",
"addy_zip": "67211",
"location_comments": null,
"default": null,
"saved": 1,
"color": "#DC136C",
"timezone": {
"id": 4,
"name": "America/Denver",
"offset": "-07:00"
},
"companies_payroll_rulesets_id": null,
"payroll_rule_display": null,
"latitude": "37.669422",
"longitude": "-97.320435",
"default_clients_id": "hAjwQ",
"default_areas": []
}The
location, address, city, zip, and timezone_id fields are required. All other fields are optional.Use the
default_areas field to associate areas with the location at creation time. Area IDs can be retrieved from the Get Areas endpoint.Authorizations
Body
application/json
Location details
Location name
Required string length:
1 - 150Street address
Required string length:
1 - 150City
Required string length:
1 - 75ZIP/postal code
Required string length:
1 - 10Timezone identifier
Required range:
x <= 999Hex color code
Maximum string length:
7Additional comments
Maximum string length:
65535Default client hashed ID
Maximum string length:
5Default area IDs
Response
Created
Location identifier
Location name
Street address
City
ZIP/postal code
Additional comments
Whether this is the default location (0 or 1)
Required range:
0 <= x <= 1Whether the location is saved (0 or 1)
Required range:
0 <= x <= 1Hex color code
Example:
"#DC136C"
Location timezone
Show child attributes
Show child attributes
Associated payroll ruleset ID
Payroll rule display name
GPS latitude coordinate
GPS longitude coordinate
Default client hashed ID
Default area IDs
⌘I
Create Location
curl --request POST \
--url https://api.roostedhr.com/api/1_12/locations \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--data '
{
"location": "Henry Park",
"address": "1325 S Ellis St, Wichita, KS 67211, USA",
"city": "Wichita",
"zip": "67211",
"color": "#DC136C",
"location_comments": "",
"timezone_id": 4,
"default_clients_id": "hAjwQ",
"default_areas": []
}
'import requests
url = "https://api.roostedhr.com/api/1_12/locations"
payload = {
"location": "Henry Park",
"address": "1325 S Ellis St, Wichita, KS 67211, USA",
"city": "Wichita",
"zip": "67211",
"color": "#DC136C",
"location_comments": "",
"timezone_id": 4,
"default_clients_id": "hAjwQ",
"default_areas": []
}
headers = {
"X-API-KEY": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-KEY': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
location: 'Henry Park',
address: '1325 S Ellis St, Wichita, KS 67211, USA',
city: 'Wichita',
zip: '67211',
color: '#DC136C',
location_comments: '',
timezone_id: 4,
default_clients_id: 'hAjwQ',
default_areas: []
})
};
fetch('https://api.roostedhr.com/api/1_12/locations', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.roostedhr.com/api/1_12/locations",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'location' => 'Henry Park',
'address' => '1325 S Ellis St, Wichita, KS 67211, USA',
'city' => 'Wichita',
'zip' => '67211',
'color' => '#DC136C',
'location_comments' => '',
'timezone_id' => 4,
'default_clients_id' => 'hAjwQ',
'default_areas' => [
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-KEY: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.roostedhr.com/api/1_12/locations"
payload := strings.NewReader("{\n \"location\": \"Henry Park\",\n \"address\": \"1325 S Ellis St, Wichita, KS 67211, USA\",\n \"city\": \"Wichita\",\n \"zip\": \"67211\",\n \"color\": \"#DC136C\",\n \"location_comments\": \"\",\n \"timezone_id\": 4,\n \"default_clients_id\": \"hAjwQ\",\n \"default_areas\": []\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-KEY", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.roostedhr.com/api/1_12/locations")
.header("X-API-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"location\": \"Henry Park\",\n \"address\": \"1325 S Ellis St, Wichita, KS 67211, USA\",\n \"city\": \"Wichita\",\n \"zip\": \"67211\",\n \"color\": \"#DC136C\",\n \"location_comments\": \"\",\n \"timezone_id\": 4,\n \"default_clients_id\": \"hAjwQ\",\n \"default_areas\": []\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.roostedhr.com/api/1_12/locations")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-KEY"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"location\": \"Henry Park\",\n \"address\": \"1325 S Ellis St, Wichita, KS 67211, USA\",\n \"city\": \"Wichita\",\n \"zip\": \"67211\",\n \"color\": \"#DC136C\",\n \"location_comments\": \"\",\n \"timezone_id\": 4,\n \"default_clients_id\": \"hAjwQ\",\n \"default_areas\": []\n}"
response = http.request(request)
puts response.read_body{
"id": "78590",
"location": "Henry Park",
"addy_street_number": "1325 S Ellis St, Wichita, KS 67211, USA",
"addy_city": "Wichita",
"addy_zip": "67211",
"location_comments": null,
"default": null,
"saved": 1,
"color": "#DC136C",
"timezone": {
"id": 4,
"name": "America/Denver",
"offset": "-07:00"
},
"companies_payroll_rulesets_id": null,
"payroll_rule_display": null,
"latitude": "37.669422",
"longitude": "-97.320435",
"default_clients_id": "hAjwQ",
"default_areas": []
}