The Add Location API allows you to add a location, with or without attrubutes to a ZetaSafe client. If you are POSTing attributes, then the format is
attribute definition ID : attribute value
A valid x-Auth-token header, belonging to the user adding the location is required.
URI
Development
Production
Method
POST
Content Type
application/json
Body
Required Fields: The name of the new location and the parentLocationId if the new location is not a top level location.
Example (Sublocation)
{"name": "API TEST", "parentLocationId": 18594373}
All Fields Example (Top Level Location)
{
"address":{"city":"x","country":216,"latitude":"Latitude","line1":"x","line2":"x","longitude":"Longitude","postalcode":"x","state":"x"},
"attributes":{"191426467":"12","191426468":"2121-12-12","191426469":"12"},
"altitude":"Altitude",
"description":"Description",
"healthAndSafetyRisks":"H&S Risks",
"latitude":"Latitude",
"locationType":LocationTypeString,
"longitude":"Longitude",
"name":"Location Name",
"riskRating":3,
"uniqueIdentifier":"Unique",
}
The attributes field is a map of String - String pairs. The first being the attribute definition id and the second being the value of the attribute. In the case of a date attribute the date format is YYYY-MM-DD.
You should send the location type name in the locationType field. Please do not send the location type PK. If the location type exists in ZetaSafe the correct PK is assigned. If the location type does not exist, it is automatically added to ZetaSafe and assigned to the location.
Address field lengths
line 1 = 90
line 2 = 90
city = 50
county = 50
postcode = 10
country = 2
The country code of the optional location address is based on the ordinal of the country in the following list (counting from 0)
AL("Albania"),
DZ("Algeria"),
AS("American Samoa"),
AD("Andorra"),
AO("Angola"),
AI("Anguilla"),
AQ("Antarctica"),
AG("Antigua and Barbuda"),
AR("Argentina"),
AM("Armenia"),
AW("Aruba"),
AU("Australia"),
AT("Austria"),
AZ("Azerbaijan"),
BS("Bahamas"),
BH("Bahrain"),
BD("Bangladesh"),
BB("Barbados"),
BY("Belarus"),
BE("Belgium"),
BZ("Belize"),
BJ("Benin"),
BM("Bermuda"),
BT("Bhutan"),
BO("Bolivia"),
BA("Bosnia and Herzegovina"),
BW("Botswana"),
BV("Bouvet Island"),
BR("Brazil"),
IO("British Indian Ocean Territory"),
BN("Brunei Darussalam"),
BG("Bulgaria"),
BF("Burkina FASO"),
BI("Burundi"),
KH("Cambodia"),
CM("Cameroon"),
CA("Canada"),
CV("Cape Verde"),
KY("Cayman Islands"),
CF("Central African Republic"),
TD("Chad"),
CL("Chile"),
CN("China"),
CX("Christmas Island"),
CC("Cocos (Keeling) Islands"),
CO("Colombia"),
KM("Comoros"),
CG("Congo"),
CD("Democratic Republic of the Congo"),
CK("Cook Islands"),
CR("Costa Rica"),
CI("Cote dIvoire"),
HR("Croatia"),
CY("Cyprus"),
CZ("Czech Republic"),
DK("Denmark"),
DJ("Djibouti"),
DM("Dominica"),
DO("Dominican Republic"),
TP("East Timor"),
EC("Ecuador"),
EG("Egypt"),
SV("El Salvador"),
GQ("Equatorial Guinea"),
ER("Eritrea"),
EE("Estonia"),
ET("Ethiopia"),
FK("Falkland Islands"),
FO("Faroe Islands"),
FJ("Fiji"),
FI("Finland"),
FR("France"),
GF("French Guiana"),
PF("French Polynesia"),
TF("French Southern Territories"),
GA("Gabon"),
GM("Gambia"),
GE("Georgia"),
DE("Germany"),
GH("Ghana"),
GI("Gibraltar"),
GR("Greece"),
GL("Greenland"),
GD("Grenada"),
GP("Guadeloupe"),
GU("Guam"),
GT("Guatemala"),
GN("Guinea"),
GW("Guinea-Bissau"),
GY("Guyana"),
HT("Haiti"),
HM("Heard and Mc Donald Islands"),
HN("Honduras"),
HK("Hong Kong"),
HU("Hungary"),
IS("Iceland"),
IN("India"),
ID("Indonesia"),
IE("Ireland"),
IL("Israel"),
IT("Italy"),
JM("Jamaica"),
JP("Japan"),
JO("Jordan"),
KZ("Kazakhstan"),
KE("Kenya"),
KI("Kiribati"),
KR("Korea"),
KW("Kuwait"),
KG("Kyrgyzstan"),
LA("Lao Peoples Democratic Republic"),
LV("Latvia"),
LB("Lebanon"),
LS("Lesotho"),
LR("Liberia"),
LY("Libya"),
LI("Liechtenstein"),
LT("Lithuania"),
LU("Luxembourg"),
MO("Macau"),
MK("Macedonia"),
MG("Madagascar"),
MW("Malawi"),
MY("Malaysia"),
MV("Maldives"),
ML("Mali"),
MT("Malta"),
MH("Marshall Islands"),
MQ("Martinique"),
MR("Mauritania"),
MU("Mauritius"),
YT("Mayotte"),
MX("Mexico"),
FM("Micronesia"),
MD("Moldova"),
MC("Monaco"),
MN("Mongolia"),
ME("Montenegro"),
MS("Montserrat"),
MA("Morocco"),
MZ("Mozambique"),
MM("Myanmar"),
NA("Namibia"),
NR("Nauru"),
NP("Nepal"),
NL("Netherlands"),
AN("Netherlands Antilles"),
NC("New Caledonia"),
NZ("New Zealand"),
NI("Nicaragua"),
NE("Niger"),
NG("Nigeria"),
NU("Niue"),
NF("Norfolk Island"),
MP("Northern Mariana Islands"),
NO("Norway"),
OM("Oman"),
PK("Pakistan"),
PW("Palau"),
PA("Panama"),
PG("Papua New Guinea"),
PY("Paraguay"),
PE("Peru"),
PH("Philippines"),
PN("Pitcairn"),
PL("Poland"),
PT("Portugal"),
PR("Puerto Rico"),
QA("Qatar"),
RE("Reunion"),
RO("Romania"),
RU("Russian Federation"),
RW("Rwanda"),
KN("Saint Kitts and Nevis"),
LC("Saint Lucia"),
VC("Saint Vincent and the Grenadines"),
WS("Samoa (Independent)"),
SM("San Marino"),
ST("Sao Tome and Principe"),
SA("Saudi Arabia"),
SN("Senegal"),
RS("Serbia"),
SC("Seychelles"),
SL("Sierra Leone"),
SG("Singapore"),
SK("Slovakia"),
SI("Slovenia"),
SB("Solomon Islands"),
SO("Somalia"),
ZA("South Africa"),
GS("South Georgia and the South Sandwich Islands"),
ES("Spain"),
LK("Sri Lanka"),
SH("St. Helena"),
PM("St. Pierre And Miquelon"),
SR("Suriname"),
SJ("Svalbard and Jan Mayen Islands"),
SZ("Swaziland"),
SE("Sweden"),
CH("Switzerland"),
TW("Taiwan"),
TJ("Tajikistan"),
TZ("Tanzania"),
TH("Thailand"),
TG("Togo"),
TK("Tokelau"),
TO("Tonga"),
TT("Trinidad and Tobago"),
TN("Tunisia"),
TR("Turkey"),
TM("Turkmenistan"),
TC("Turks and Caicos Islands"),
TV("Tuvalu"),
UG("Uganda"),
UA("Ukraine"),
AE("United Arab Emirates"),
GB("United Kingdom"),
US("United States"),
UM("United States Minor Outlying Islands"),
UY("Uruguay"),
UZ("Uzbekistan"),
VU("Vanuatu"),
VA("Vatican City State (Holy See)"),
VE("Venezuela"),
VN("Viet Nam"),
VG("Virgin Islands (British)"),
VI("Virgin Islands (U.S.)"),
WF("Wallis and Futuna Islands"),
EH("Western Sahara"),
YE("Yemen"),
ZM("Zambia"),
ZW("Zimbabwe");
Responses:
201: Created - the record id returned
{"recordId":1021156388}
This successful response is the ZetaSafe location PK (Primary Key). This can be used for any additional related data which is required such ass assets or publications.
400: Bad Request - an explanation is returned
{"result":"FOREIGN_KEY_INVALID",
"headings":[{"key":"ok","value":"OK"}],
"title":"Record not found",
"message":"The Parent Location with an ID value of 2004009726 could not be found."}
403: Unauthorised/Access Denied
{
"timestamp": 1556533789103,
"status": 500,
"error": "Internal Server Error",
"exception": "java.lang.NullPointerException",
"message": "No message available",
"path": "//v1/location/handheld/add"
}
500: Error with the internal process of adding a location.