Get place attributes for hotels in Berlin by requesting different field groups
What are place details?
Place details are the attributes associated with a place such as name, street address, hours of operation, phone number, website, social media sites, and user ratings. The number of attributes available for a place can vary. For example, attributes such as opening hours may not be available for places that are geographic places or landmarks.
You can use place details to:
Return key attributes for a place.
Find the address and locale information.
Get telephone, email, and website information.
Get user and cost ratings.
Gain insight and compare places.
How to get place details
To get place attributes you use the places service /places/{placeId} request with a valid place ID. To get a place ID, you can perform a nearby search or bounding box search. Once you have a placeId, you need to define a list of the fields you would like with the requestedFields parameter. For example, requestedFields: ["name", "categoryId", "address:streetAddress"] or requestedFields: all.
The array of fields that define the attributes to return for a place.
Use this parameter to define the attributes you would like returned,
for example requestedFields=name,address:streetAddress. However, you can also
set this value to requestedFields=all to return all of the attributes available
for a place.
The placeId attribute is always returned in addition to the other
attributes you requested. If a valid attribute value is not available,
null, or an empty collection, is returned and you are not charged for it. To see the fields and
pricing groups they belong to, go to the table above.
The authentication token with the premium:user:places privilege, used to access the Places service.
The token parameter can be either an API Key or short-lived token. See
ArcGIS security
documentation
for more information on authenticating with a token or API key.
Alternatively, you can supply a token in the request header with one of
the following keys using the "Bearer" scheme:
Authorization: Bearer <YOUR_TOKEN>
X-Esri-Authorization: Bearer <YOUR_TOKEN>
Code examples
Get place attributes
This example uses /places/{placeId} to get the place attributes for bd5f5dfa788b7c5f59f3bfe2cc3d9c60. The place attributes are the primary attributes for every place and include name and categories. The values are always valid. The attributes are displayed below.
Steps
Reference the places service.
Set the place ID.
In the requestedFields parameter, specify the fields from the Place group.
Set the token parameter to your access token.
Get the place group attributes for The White House.
This example uses /places/{placeId} to get the address attributes for bd5f5dfa788b7c5f59f3bfe2cc3d9c60. The address attributes describe the location and delivery information associated with a place. All of the attributes with valid values are displayed below. Attributes such as address:poBox, address:postTown, and address:extended do not apply and are null.
Steps
Reference the places service.
Set the place ID.
In the requestedFields parameter, specify the fields from the Address place group.
Set the token parameter to your access token.
Get the address group attributes for The White House.
This example uses /places/{placeId} to get the details attributes for bd5f5dfa788b7c5f59f3bfe2cc3d9c60. The details attributes include a description, contact, social, and rating information. All of the valid attributes with valid values are displayed below. Attributes such as hours:opening, rating:price, and chains do not apply and are null.
Steps
Reference the places service.
Set the place ID.
In the requestedFields parameter, specify the fields from the details price group.
Set the token parameter to your access token.
Get the details group attributes for The White House.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
{
"placeDetails": {
"placeId": "bd5f5dfa788b7c5f59f3bfe2cc3d9c60",
"description": "The White House is the official residence & principal workplace of the President of the United States. The house was designed by Irish-born James Hoban, and built between 1792 & 1800 of white-painted Aquia Creek sandstone in the Neoclassical style. Residence of every U.S. president since John Adams.",
"contactInfo": {
"telephone": "(202) 456-1111",
"website": "http://www.whitehouse.gov",
"fax": "(202) 456-2461",
"email": "comments@whitehouse.gov" },
"socialMedia": {
"facebookId": "1191441824276882",
"twitter": "whitehouse",
"instagram": "whitehouse" },
"rating": {
"price": null,
"user": 4.4 },
"chains": []
}
}