Work Location APIs
Work locations represent your organization's branches or offices. Adding all work locations to Zoho One streamlines employee onboarding and administration across different offices or branches.
Create a new work location
Creates a new work location in the given organization with the provided details. Information such as the name of the location, postal address, timezone, and language should be sent in the request payload to create a location.
OAuth Scope : ZohoOne.Orgs.CREATE
Arguments
Path Parameters
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\"field1\":\"value1\",\"field2\":\"value2\"}");
Request request = new Request.Builder()
.url("https://zohoapis.com/one/api/v2/orgs/987000000654321/locations")
.post(body)
.addHeader("Authorization", "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f")
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
parameters_data='{"field1":"value1","field2":"value2"}';
headers_data = Map();
headers_data.put("Authorization", "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f");
response = invokeUrl
[
url: "https://zohoapis.com/one/api/v2/orgs/987000000654321/locations"
type: POST
headers: headers_data
content-type: application/json
parameters: parameters_data
connection: <connection_name>
];
info response;
const http = require("https");
const options = {
"method": "POST",
"hostname": "zohoapis.com",
"port": null,
"path": "/one/api/v2/orgs/987000000654321/locations",
"headers": {
"Authorization": "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f",
"content-type": "application/json"
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({field1: 'value1', field2: 'value2'}));
req.end();
import http.client
conn = http.client.HTTPSConnection("zohoapis.com")
payload = "{\"field1\":\"value1\",\"field2\":\"value2\"}"
headers = {
'Authorization': "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f",
'content-type': "application/json"
}
conn.request("POST", "/one/api/v2/orgs/987000000654321/locations", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
curl --request POST \
--url https://zohoapis.com/one/api/v2/orgs/987000000654321/locations \
--header 'Authorization: Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f' \
--header 'content-type: application/json' \
--data '{"field1":"value1","field2":"value2"}'
{
"locations": {
"location_name": "Work Location 1",
"street_address": "1xx, Dxxxxx xxxxx, xxxxxt",
"city": "Txxxxr",
"state": "Kxxxxa",
"postal_code": "9xxxx9",
"country": "in",
"timezone": "Etc/GMT+12",
"language": "en"
}
}
{
"status_code": 201,
"resource_name": "locations",
"message": "... //Successfully completed",
"locations": {
"location_id": ".....",
"href": "....."
}
}
{
"status_code": 400,
"error_code": "invalid_field_value",
"message": "If location_name is empty or invalid"
}
{
"status_code": 401,
"error_code": "INVALID_TOKEN",
"message": "Authentication required."
}
{
"status_code": 403,
"error_code": "no_permission",
"message": "API is accessible to admins alone"
}
{
"status_code": 404,
"error_code": "RESOURCE_NOT_FOUND",
"message": "The requested resource was not found."
}
Get all work locations available in the organization
Fetches all the locations and their details added to the organization in Zoho One. This includes the postal address given while adding the location, the ID of the location, and indication whether the location is set as primary or not.
OAuth Scope : ZohoOne.Orgs.READ
Path Parameters
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("https://zohoapis.com/one/api/v2/orgs/987000000654321/locations")
.get()
.addHeader("Authorization", "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f")
.build();
Response response = client.newCall(request).execute();
headers_data = Map();
headers_data.put("Authorization", "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f");
response = invokeUrl
[
url: "https://zohoapis.com/one/api/v2/orgs/987000000654321/locations"
type: GET
headers: headers_data
connection: <connection_name>
];
info response;
const http = require("https");
const options = {
"method": "GET",
"hostname": "zohoapis.com",
"port": null,
"path": "/one/api/v2/orgs/987000000654321/locations",
"headers": {
"Authorization": "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f"
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
import http.client
conn = http.client.HTTPSConnection("zohoapis.com")
headers = { 'Authorization': "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f" }
conn.request("GET", "/one/api/v2/orgs/987000000654321/locations", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
curl --request GET \
--url https://zohoapis.com/one/api/v2/orgs/987000000654321/locations \
--header 'Authorization: Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f'
{
"status_code": 200,
"resource_name": "locations",
"locations": [
{
"street_address": "1xx, Dxxxxx xxxxx, xxxxxt",
"country": "in",
"location_name": "Work Location 1",
"is_primary": true,
"city": "Txxxxr",
"timezone": "Etc/GMT+12",
"language": "en",
"state": "Kxxxxa",
"postal_code": "9xxxx9",
"location_id": "1xxxxxx8"
},
{...},
{...}
]
}
{
"status_code": 401,
"error_code": "INVALID_TOKEN",
"message": "Authentication required."
}
{
"status_code": 403,
"error_code": "no_permission",
"message": "API is accessible to admins only"
}
{
"status_code": 404,
"error_code": "RESOURCE_NOT_FOUND",
"message": "The requested resource was not found."
}
Update a work location's details
Modify any existing work location with the required details.
OAuth Scope : ZohoOne.Orgs.UPDATE
Arguments
Path Parameters
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\"field1\":\"value1\",\"field2\":\"value2\"}");
Request request = new Request.Builder()
.url("https://zohoapis.com/one/api/v2/orgs/987000000654321/locations/1xxxxxx8")
.put(body)
.addHeader("Authorization", "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f")
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
parameters_data='{"field1":"value1","field2":"value2"}';
headers_data = Map();
headers_data.put("Authorization", "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f");
response = invokeUrl
[
url: "https://zohoapis.com/one/api/v2/orgs/987000000654321/locations/1xxxxxx8"
type: PUT
headers: headers_data
content-type: application/json
parameters: parameters_data
connection: <connection_name>
];
info response;
const http = require("https");
const options = {
"method": "PUT",
"hostname": "zohoapis.com",
"port": null,
"path": "/one/api/v2/orgs/987000000654321/locations/1xxxxxx8",
"headers": {
"Authorization": "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f",
"content-type": "application/json"
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({field1: 'value1', field2: 'value2'}));
req.end();
import http.client
conn = http.client.HTTPSConnection("zohoapis.com")
payload = "{\"field1\":\"value1\",\"field2\":\"value2\"}"
headers = {
'Authorization': "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f",
'content-type': "application/json"
}
conn.request("PUT", "/one/api/v2/orgs/987000000654321/locations/1xxxxxx8", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
curl --request PUT \
--url https://zohoapis.com/one/api/v2/orgs/987000000654321/locations/1xxxxxx8 \
--header 'Authorization: Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f' \
--header 'content-type: application/json' \
--data '{"field1":"value1","field2":"value2"}'
{
"locations": {
"location_name": "Work Location 1",
"street_address": "1xx, Dxxxxx xxxxx, xxxxxt",
"city": "Txxxxr",
"state": "Kxxxxa",
"postal_code": "9xxxx9",
"country": "in",
"timezone": "Etc/GMT+12",
"language": "en"
}
}
{
"status_code": 200,
"resource_name": "locations",
"message": "... //Successfully completed",
"locations": {
"location_id": ".....",
"href": "....."
}
}
{
"status_code": 400,
"error_code": "invalid_field_value",
"message": "If the updated location_name does not match the allowed pattern"
}
{
"status_code": 401,
"error_code": "INVALID_TOKEN",
"message": "Authentication required."
}
{
"status_code": 403,
"error_code": "no_permission",
"message": "API is accessible to admins alone"
}
{
"status_code": 404,
"error_code": "invalid_identifier",
"message": "If the location is not found by the given location_id"
}
{
"status_code": 500,
"error_code": "general_error",
"message": "If an internal error occurs during IAM primary location update"
}
Get specific work location's details
Fetches given location's details added to the organization in Zoho One. This includes the postal address given while adding the location and indication whether the location is set as primary or not.
OAuth Scope : ZohoOne.Orgs.READ
Path Parameters
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("https://zohoapis.com/one/api/v2/orgs/987000000654321/locations/1xxxxxx8")
.get()
.addHeader("Authorization", "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f")
.build();
Response response = client.newCall(request).execute();
headers_data = Map();
headers_data.put("Authorization", "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f");
response = invokeUrl
[
url: "https://zohoapis.com/one/api/v2/orgs/987000000654321/locations/1xxxxxx8"
type: GET
headers: headers_data
connection: <connection_name>
];
info response;
const http = require("https");
const options = {
"method": "GET",
"hostname": "zohoapis.com",
"port": null,
"path": "/one/api/v2/orgs/987000000654321/locations/1xxxxxx8",
"headers": {
"Authorization": "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f"
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
import http.client
conn = http.client.HTTPSConnection("zohoapis.com")
headers = { 'Authorization': "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f" }
conn.request("GET", "/one/api/v2/orgs/987000000654321/locations/1xxxxxx8", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
curl --request GET \
--url https://zohoapis.com/one/api/v2/orgs/987000000654321/locations/1xxxxxx8 \
--header 'Authorization: Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f'
{
"status_code": 200,
"resource_name": "locations",
"locations": {
"street_address": "1xx, Dxxxxx xxxxx, xxxxxt",
"country": "in",
"location_name": "Work Location 1",
"is_primary": true,
"city": "Txxxxr",
"timezone": "Etc/GMT+12",
"language": "en",
"state": "Kxxxxa",
"postal_code": "9xxxx9",
"location_id": "1xxxxxx8"
}
}
{
"status_code": 401,
"error_code": "INVALID_TOKEN",
"message": "Authentication required."
}
{
"status_code": 403,
"error_code": "no_permission",
"message": "API is accessible to admins only"
}
{
"status_code": 404,
"error_code": "RESOURCE_NOT_FOUND",
"message": "The requested resource was not found."
}
Delete a work location
Deletes the given work location from the relevant organization in Zoho One.
OAuth Scope : ZohoOne.Orgs.DELETE
Path Parameters
Query Parameters
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("https://zohoapis.com/one/api/v2/orgs/987000000654321/locations/1xxxxxx8")
.delete(null)
.addHeader("Authorization", "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f")
.build();
Response response = client.newCall(request).execute();
headers_data = Map();
headers_data.put("Authorization", "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f");
response = invokeUrl
[
url: "https://zohoapis.com/one/api/v2/orgs/987000000654321/locations/1xxxxxx8"
type: DELETE
headers: headers_data
connection: <connection_name>
];
info response;
const http = require("https");
const options = {
"method": "DELETE",
"hostname": "zohoapis.com",
"port": null,
"path": "/one/api/v2/orgs/987000000654321/locations/1xxxxxx8",
"headers": {
"Authorization": "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f"
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
import http.client
conn = http.client.HTTPSConnection("zohoapis.com")
headers = { 'Authorization': "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f" }
conn.request("DELETE", "/one/api/v2/orgs/987000000654321/locations/1xxxxxx8", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
curl --request DELETE \
--url https://zohoapis.com/one/api/v2/orgs/987000000654321/locations/1xxxxxx8 \
--header 'Authorization: Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f'
{
"status_code": 401,
"error_code": "INVALID_TOKEN",
"message": "Authentication required."
}
{
"status_code": 403,
"error_code": "no_permission",
"message": "API is accessible to admins alone"
}
{
"status_code": 404,
"error_code": "invalid_identifier",
"message": "If the location is not found by the given location_id"
}
{
"status_code": 405,
"error_code": "unsupported_operation",
"message": "If the location is published or drafted in Zoho Publish"
}
{
"status_code": 409,
"error_code": "resource_in_use",
"message": "If users are still assigned to the location and force is not set to true"
}
Set any existing work location as primary
Marks the given work location as the primary location.
OAuth Scope : ZohoOne.Orgs.UPDATE
Path Parameters
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\"field1\":\"value1\",\"field2\":\"value2\"}");
Request request = new Request.Builder()
.url("https://zohoapis.com/one/api/v2/orgs/987000000654321/locations/1xxxxxx8/primary")
.put(body)
.addHeader("Authorization", "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f")
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
parameters_data='{"field1":"value1","field2":"value2"}';
headers_data = Map();
headers_data.put("Authorization", "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f");
response = invokeUrl
[
url: "https://zohoapis.com/one/api/v2/orgs/987000000654321/locations/1xxxxxx8/primary"
type: PUT
headers: headers_data
content-type: application/json
parameters: parameters_data
connection: <connection_name>
];
info response;
const http = require("https");
const options = {
"method": "PUT",
"hostname": "zohoapis.com",
"port": null,
"path": "/one/api/v2/orgs/987000000654321/locations/1xxxxxx8/primary",
"headers": {
"Authorization": "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f",
"content-type": "application/json"
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({field1: 'value1', field2: 'value2'}));
req.end();
import http.client
conn = http.client.HTTPSConnection("zohoapis.com")
payload = "{\"field1\":\"value1\",\"field2\":\"value2\"}"
headers = {
'Authorization': "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f",
'content-type': "application/json"
}
conn.request("PUT", "/one/api/v2/orgs/987000000654321/locations/1xxxxxx8/primary", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
curl --request PUT \
--url https://zohoapis.com/one/api/v2/orgs/987000000654321/locations/1xxxxxx8/primary \
--header 'Authorization: Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f' \
--header 'content-type: application/json' \
--data '{"field1":"value1","field2":"value2"}'
{
"status_code": 200,
"resource_name": "locations",
"message": "... //Successfully completed",
"locations": {
"id": ".....",
"href": "....."
}
}
{
"status_code": 400,
"error_code": "invalid_field_value",
"message": "Invalid or missing field in request payload."
}
{
"status_code": 401,
"error_code": "INVALID_TOKEN",
"message": "Authentication required."
}
{
"status_code": 403,
"error_code": "no_permission",
"message": "It is accessible to admins alone"
}
{
"status_code": 404,
"error_code": "RESOURCE_NOT_FOUND",
"message": "The requested resource was not found."
}
{
"status_code": 405,
"error_code": "unsupported_operation",
"message": "If the existing location has invalid field value for street address and/or city and/or state and/or country and/or postal_code"
}