Retrieve a batched collection of locations.
This resource returns a batched list of locations. The location information returned depends on the 'fields' parameter.
>>> GET("/123/locations?fields=uuid-title-url-urlname&rpp=2")
{'items': [['461f3763-00bd-11e0-8d19-001ec21bff9e',
'Sample Book Store',
'https://api.metropublisher.com/123/locations/461f3763-00bd-11e0-8d19-001ec21bff9e',
'sample-book-store'],
['fe23ac30-00bf-11e0-a955-001ec21bff9e',
'Sample Nightclub',
'https://api.metropublisher.com/123/locations/fe23ac30-00bf-11e0-a955-001ec21bff9e',
'sample-nightclub']],
'next': 'fields=uuid-title-url-urlname&page=2&rpp=2'}
page: | The page number to retrieve. optional Default: 1 Values must not be lower than 1 |
||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
rpp: | The number of results per page. optional Default: 20 Values must not be lower than 1 or higher than 100 |
||||||||||||||||||||||||
state: | optional Default: 'live' if the user is a public user else None. Example value: "draft" Values must be any of the following
|
||||||||||||||||||||||||
type: | Filter the results by whether the location is a location, a standard listing or a sponsored listing. Note Only applies if the instance has the Directory Add-On. optional Default: None Values must obey all the conditions
|
||||||||||||||||||||||||
fields: | A dash-separated list of fields to return. optional Default: ['url'] Example value: 'coords-uuid' Every element of the list must be any of the following
|
||||||||||||||||||||||||
order: | A dash-separated list of orderings to apply optional Default: [] Example value: 'sort_title-urlname.desc' Every element of the list must be any of the following
|
Deletes a location.
>>> DELETE("/123/locations/799d6c73-fe75-11df-837b-001ec21bff9e")
{'msg': 'deleted'}
Retrieve one location.
This resource returns information about one specific location. The information it returns depends on the role of the API key. Some attributes are not publicly available.
>>> GET("/123/locations/14c68945-00ca-11e0-a6cf-001ec21bff9e")
{'closed': False,
'content': '<p>Sed elit. In blandit sapien at nisi. ... Nam convallis tristique justo.</p>',
'coords': [37.7981976, -122.4073589],
'created': '2010-12-05T15:47:55.118294',
'description': 'This is descriptive text for a location. ...',
'email': None,
'fax': None,
'fb_headline': None,
'fb_show_faces': True,
'fb_show_stream': True,
'fb_url': None,
'geoname_id': 5391959,
'lat': 37.7981976,
'location_types': [],
'long': -122.4073589,
'modified': '2010-12-05T15:47:55.118294',
'opening_hours': 'Tuesday through Sunday 6PM - 11PM',
'pcode': '94133',
'phone': '(415) 123-4563',
'price_index': 'Moderate',
'print_description': None,
'sort_title': None,
'state': 'published',
'street': 'Columbus Avenue',
'streetnumber': '325',
'thumb_url': None,
'title': 'Sample Restaurant',
'twitter_username': None,
'urlname': 'sample-restaurant',
'uuid': '14c68945-00ca-11e0-a6cf-001ec21bff9e',
'website': 'http://www.sample.com'}
closed: | If true, the location is no longer in business. |
---|---|
contact_email: | The email address of the person to contact regarding the listing, for internal use only. Note only available for instances with Directory Add-On |
contact_person: | The name of the person to contact regarding the listing, for internal use only. Note only available for instances with Directory Add-On |
content: | see HTML-XML |
coords: | The coordinates of the location consisting of latitude and longitude. Note If set to None, the location has no physical address. The fields street, streetnumber, pcode and geoname_id will be ignored/automatically set to None. |
coupon_description: | Description of the coupon. Note only available for instances with Directory Add-On |
coupon_expires: | The date/time when the coupon expires. A date/time in ISO 8601 format. See Dates and Times. Note only available for instances with Directory Add-On |
coupon_img_url: | API url to the coupon image. Note only available for instances with Directory Add-On |
coupon_img_uuid: | UUID of a linked coupon image. Note only available for instances with Directory Add-On |
coupon_start: | The start date/time when the coupon becomes valid. A date/time in ISO 8601 format. See Dates and Times. Note only available for instances with Directory Add-On |
coupon_title: | Title of the coupon. Note only available for instances with Directory Add-On |
created: | The creation date/time in ISO 8601 format. See Dates and Times. Access is restricted to users with these roles: |
description: | A short description of the location. |
email: | Email of the location. |
fax: | Fax number of the location. |
fb_headline: | Headline for the location's Facebook widget. |
fb_show_faces: | Defines whether people's photos appear in the Facebook widget. |
fb_show_stream: | Defines whether the Facebook stream appears in the Facebook widget. |
fb_url: | Facebook URL of the location. |
geoname_id: | The location's GeoName ID, see GeoNames. If a location has an address, then the address's city is defined using the geoname_id. The GeoName ID 3513090, for example, is the ID for Willemstad, the capital city of Curaçao. Note If not provided, the default geoname_id of the MP instance will be used. Note Ignored/automatically set to None if coords == None. |
is_listing: | Defines whether this location is a standard location or a listing. Note only available for instances with Directory Add-On |
lat: | |
listing_expires: | The date/time when the listing reverts to a normal location again, i.e. when the listing expires. A date/time in ISO 8601 format. See Dates and Times. Note only available for instances with Directory Add-On |
listing_start: | The start date/time when the location becomes a listing. A date/time in ISO 8601 format. See Dates and Times. Note only available for instances with Directory Add-On |
long: | |
modified: | The date/time of last modification in ISO 8601 format. See Dates and Times. Access is restricted to users with these roles: |
opening_hours: | The opening hours of the location |
pcode: | Postal/Zip Code of the location. Note Ignored/automatically set to None if coords == None. |
phone: | Phone number of the location. |
price_index: | A general definer of the location price, e.g. how expensive a restaurant is. |
print_description: | |
sort_title: | |
sponsored: | Defines whether a listing is a standard or an sponsored listing. Note only available for instances with Directory Add-On |
state: | |
street: | The location's street. Note Ignored/automatically set to None if coords == None. |
streetnumber: | The street/house number of the location. Note Ignored/automatically set to None if coords == None. |
thumb_url: | The API url to the location's thumbnail image. |
title: | The title of the location. |
twitter_username: | Twitter username (without @) for the location. |
urlname: | The location's urlname. |
uuid: | The UUID of the location |
website: | Website of the location. |
Create/update a location.
Sending data to this resource does one of two things:
>>> PUT("/123/locations/12345678-1234-1234-1234-123456789abc", {"urlname": "location-a",
... "coords": [40.1965, -74.16848],
... "geoname_id": 5097844,
... "title": "Location A"})
{'url': 'https://api.metropublisher.com/123/locations/12345678-1234-1234-1234-123456789abc',
'uuid': '12345678-1234-1234-1234-123456789abc'}
>>> PUT("/123/locations/12345678-1234-1234-1234-123456789ccc", {"urlname": "location-c",
... "coords": [40.1965, -74.16848],
... "geoname_id": 5097844,
... "title": "Location C",
... "is_listing": "true",
... "contact_person": "Peter Parker",
... "listing_start": "2014-03-05"})
{'url': 'https://api.metropublisher.com/123/locations/12345678-1234-1234-1234-123456789ccc',
'uuid': '12345678-1234-1234-1234-123456789ccc'}
urlname: | see urlname required Example value: "biblioteka-públiko-kórsou" Values must obey all the conditions
|
||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
title: | The location title required Example value: "Biblioteka Públiko Kórsou" |
||||||||||
description: | A short description of the location. optional Default: None Values must not be longer than 250 |
||||||||||
coords: | The coordinates of the location consisting of latitude and longitude. Note If set to None, the location has no physical address. The fields street, streetnumber, pcode and geoname_id will be ignored/automatically set to None. optional Default: None Example value: [12.1084, -68.93365]
|
||||||||||
state: | optional Default: 'draft' Values must be any of the following
|
||||||||||
thumb_uuid: | The UUID of the location image. optional Default: None Example value: '123456578-1234-1234-1234-123456789abc' Values must obey all the conditions
|
||||||||||
street: | The location's street. Note Ignored/automatically set to None if coords == None. optional Default: None |
||||||||||
streetnumber: | The street/house number of the location. Note Ignored/automatically set to None if coords == None. optional Default: None |
||||||||||
pcode: | Postal/Zip Code of the location. Note Ignored/automatically set to None if coords == None. optional Default: None |
||||||||||
geoname_id: | The location's GeoName ID, see GeoNames. If a location has an address, then the address's city is defined using the geoname_id. The GeoName ID 3513090, for example, is the ID for Willemstad, the capital city of Curaçao. Note If not provided, the default geoname_id of the MP instance will be used. Note Ignored/automatically set to None if coords == None. optional Example value: 3513090 Must be a geoname id (see GeoNames) |
||||||||||
phone: | Phone number of the location. optional Default: None |
||||||||||
fax: | Fax number of the location. optional Default: None |
||||||||||
email: | Email of the location. optional Default: None Values must match the following regular expression: ^[A-Za-z0-9!#$%&'*+/=?^_`{|}~.-]+@[A-Za-z0-9.-]+\.[A-Za-z]*$
Info: The regular expression tries to verify the following pattern: <string of characters>@<string of characters>.<string of characters> The first string may contain a number of different special characters besides letters and numbers, such as an underscore (_) or asterisk (*), while the second string must contain only letters, numbers, dashes (-) and dots (.). |
||||||||||
website: | Website of the location. optional Default: None Example value: "http://www.curacaopubliclibrary.an/" Values must obey all the conditions
|
||||||||||
price_index: | A general definer of the location price, e.g. how expensive a restaurant is. optional Default: None Example value: "free" Values must be any of the following
|
||||||||||
opening_hours: | The opening hours of the location optional Default: None |
||||||||||
content: | see HTML-XML optional Default: None Example value: "<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.<p>" Values must obey all the conditions
|
||||||||||
created: | The creation date/time in ISO 8601 format. See Dates and Times. optional Default: <current timestamp> Example value: '2012-01-01T11:30:45' Values must restricted to users with these roles: |
||||||||||
modified: | The date/time of last modification in ISO 8601 format. See Dates and Times. optional Default: <current timestamp> Example value: '2012-01-01T11:30:45' Values must restricted to users with these roles: |
||||||||||
location_types: | Deprecated since MP 3.x: As of MP 3.0, all location types have been converted to tags. Please see the tagging resources to assign tags to locations. (also see ChangeLog) optional Default: None |
||||||||||
closed: | If true, the location is no longer in business. optional Default: False Values must be any of the following
|
||||||||||
print_description: | optional Default: None |
||||||||||
sort_title: | optional Default: None |
||||||||||
fb_headline: | Headline for the location's Facebook widget. optional Default: None Values must not be longer than 255 |
||||||||||
fb_url: | Facebook URL of the location. optional Default: None Values must obey all the conditions
|
||||||||||
fb_show_faces: | Defines whether people's photos appear in the Facebook widget. optional Default: True Values must be any of the following
|
||||||||||
fb_show_stream: | Defines whether the Facebook stream appears in the Facebook widget. optional Default: True Values must be any of the following
|
||||||||||
twitter_username: | Twitter username (without @) for the location. optional Default: None must be the username without @ and must contain only letters, numbers or underscore (_); no longer than 15 characters |
||||||||||
is_listing: | Defines whether this location is a standard location or a listing. optional Default: False Values must obey all the conditions
|
Additional parameters for type: is_listing = True
coupon_img_uuid: | UUID of a linked coupon image. optional Default: None Example value: '123456578-1234-1234-1234-123456789abc' Values must obey all the conditions
|
||||
---|---|---|---|---|---|
coupon_title: | Title of the coupon. optional Default: None Values must obey all the conditions
|
||||
coupon_description: | Description of the coupon. optional Default: None Values must obey all the conditions
|
||||
coupon_start: | The start date/time when the coupon becomes valid. A date/time in ISO 8601 format. See Dates and Times. optional Default: None Example value: '2012-01-01T11:30:45' Values must obey all the conditions
|
||||
coupon_expires: | The date/time when the coupon expires. A date/time in ISO 8601 format. See Dates and Times. optional Default: None Example value: '2012-01-01T11:30:45' Values must obey all the conditions
|
||||
sponsored: | Defines whether a listing is a standard or an sponsored listing. optional Default: False Values must obey all the conditions
|
||||
contact_person: | The name of the person to contact regarding the listing, for internal use only. optional Default: None Values must obey all the conditions
|
||||
contact_email: | The email address of the person to contact regarding the listing, for internal use only. optional Default: None Values must obey all the conditions
|
||||
listing_start: | The start date/time when the location becomes a listing. A date/time in ISO 8601 format. See Dates and Times. optional Example value: '2012-01-01T11:30:45' Values must obey all the conditions
|
||||
listing_expires: | The date/time when the listing reverts to a normal location again, i.e. when the listing expires. A date/time in ISO 8601 format. See Dates and Times. optional Default: None Example value: '2012-01-01T11:30:45' Values must obey all the conditions
|
Update specific attributes of a location.
>>> PATCH("/123/locations/799d6c73-fe75-11df-837b-001ec21bff9e",
... {'title': 'NEW TITLE'})
{'url': 'https://api.metropublisher.com/123/locations/799d6c73-fe75-11df-837b-001ec21bff9e',
'uuid': '799d6c73-fe75-11df-837b-001ec21bff9e'}
urlname: | see urlname optional Example value: "biblioteka-públiko-kórsou" Values must obey all the conditions
|
||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
title: | The location title optional Example value: "Biblioteka Públiko Kórsou" |
||||||||||
description: | A short description of the location. optional Values must not be longer than 250 |
||||||||||
coords: | The coordinates of the location consisting of latitude and longitude. Note If set to None, the location has no physical address. The fields street, streetnumber, pcode and geoname_id will be ignored/automatically set to None. optional Example value: [12.1084, -68.93365]
|
||||||||||
state: | optional Values must be any of the following
|
||||||||||
thumb_uuid: | The UUID of the location image. optional Example value: '123456578-1234-1234-1234-123456789abc' Values must obey all the conditions
|
||||||||||
street: | The location's street. Note Ignored/automatically set to None if coords == None. optional |
||||||||||
streetnumber: | The street/house number of the location. Note Ignored/automatically set to None if coords == None. optional |
||||||||||
pcode: | Postal/Zip Code of the location. Note Ignored/automatically set to None if coords == None. optional |
||||||||||
geoname_id: | The location's GeoName ID, see GeoNames. If a location has an address, then the address's city is defined using the geoname_id. The GeoName ID 3513090, for example, is the ID for Willemstad, the capital city of Curaçao. Note If not provided, the default geoname_id of the MP instance will be used. Note Ignored/automatically set to None if coords == None. optional Example value: 3513090 Must be a geoname id (see GeoNames) |
||||||||||
phone: | Phone number of the location. optional |
||||||||||
fax: | Fax number of the location. optional |
||||||||||
email: | Email of the location. optional Values must match the following regular expression: ^[A-Za-z0-9!#$%&'*+/=?^_`{|}~.-]+@[A-Za-z0-9.-]+\.[A-Za-z]*$
Info: The regular expression tries to verify the following pattern: <string of characters>@<string of characters>.<string of characters> The first string may contain a number of different special characters besides letters and numbers, such as an underscore (_) or asterisk (*), while the second string must contain only letters, numbers, dashes (-) and dots (.). |
||||||||||
website: | Website of the location. optional Example value: "http://www.curacaopubliclibrary.an/" Values must obey all the conditions
|
||||||||||
price_index: | A general definer of the location price, e.g. how expensive a restaurant is. optional Example value: "free" Values must be any of the following
|
||||||||||
opening_hours: | The opening hours of the location optional |
||||||||||
content: | see HTML-XML optional Example value: "<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.<p>" Values must obey all the conditions
|
||||||||||
created: | The creation date/time in ISO 8601 format. See Dates and Times. optional Example value: '2012-01-01T11:30:45' Values must restricted to users with these roles: |
||||||||||
modified: | The date/time of last modification in ISO 8601 format. See Dates and Times. optional Example value: '2012-01-01T11:30:45' Values must restricted to users with these roles: |
||||||||||
location_types: | Deprecated since MP 3.x: As of MP 3.0, all location types have been converted to tags. Please see the tagging resources to assign tags to locations. (also see ChangeLog) optional |
||||||||||
closed: | If true, the location is no longer in business. optional Values must be any of the following
|
||||||||||
print_description: | optional |
||||||||||
sort_title: | optional |
||||||||||
fb_headline: | Headline for the location's Facebook widget. optional Values must not be longer than 255 |
||||||||||
fb_url: | Facebook URL of the location. optional Values must obey all the conditions
|
||||||||||
fb_show_faces: | Defines whether people's photos appear in the Facebook widget. optional Values must be any of the following
|
||||||||||
fb_show_stream: | Defines whether the Facebook stream appears in the Facebook widget. optional Values must be any of the following
|
||||||||||
twitter_username: | Twitter username (without @) for the location. optional must be the username without @ and must contain only letters, numbers or underscore (_); no longer than 15 characters |
||||||||||
is_listing: | Defines whether this location is a standard location or a listing. optional Values must obey all the conditions
|
Additional parameters for type: is_listing = True
coupon_img_uuid: | UUID of a linked coupon image. optional Example value: '123456578-1234-1234-1234-123456789abc' Values must obey all the conditions
|
||||
---|---|---|---|---|---|
coupon_title: | Title of the coupon. optional Values must obey all the conditions
|
||||
coupon_description: | Description of the coupon. optional Values must obey all the conditions
|
||||
coupon_start: | The start date/time when the coupon becomes valid. A date/time in ISO 8601 format. See Dates and Times. optional Example value: '2012-01-01T11:30:45' Values must obey all the conditions
|
||||
coupon_expires: | The date/time when the coupon expires. A date/time in ISO 8601 format. See Dates and Times. optional Example value: '2012-01-01T11:30:45' Values must obey all the conditions
|
||||
sponsored: | Defines whether a listing is a standard or an sponsored listing. optional Values must obey all the conditions
|
||||
contact_person: | The name of the person to contact regarding the listing, for internal use only. optional Values must obey all the conditions
|
||||
contact_email: | The email address of the person to contact regarding the listing, for internal use only. optional Values must obey all the conditions
|
||||
listing_start: | The start date/time when the location becomes a listing. A date/time in ISO 8601 format. See Dates and Times. optional Example value: '2012-01-01T11:30:45' Values must obey all the conditions
|
||||
listing_expires: | The date/time when the listing reverts to a normal location again, i.e. when the listing expires. A date/time in ISO 8601 format. See Dates and Times. optional Example value: '2012-01-01T11:30:45' Values must obey all the conditions
|
Get all tags for a location.
>>> GET("/123/locations/461f3763-00bd-11e0-8d19-001ec21bff9e/tags")
{'items': [{'predicate': 'describes',
'title': 'Sample Tag',
'url': 'https://api.metropublisher.com/123/tags/60183d70-a998-11e1-afa6-0800200c9a66',
'uuid': '60183d70-a998-11e1-afa6-0800200c9a66'},
{'predicate': 'describes',
'title': 'Restaurant',
'url': 'https://api.metropublisher.com/123/tags/7fbbe910-a998-11e1-afa6-0800200c9a66',
'uuid': '7fbbe910-a998-11e1-afa6-0800200c9a66'}]}
state: | optional Default: 'approved' if the user is a public user else None. Values must be any of the following
|
---|
Create new path history entry for the location.
This resource creates a new path history entry and adds it to the existing list of path history entries for the location.
Add a new path history entry:
>>> POST("/123/locations/799d6c73-fe75-11df-837b-001ec21bff9e/path_history",
... {"path": "/old/path/to/location/index.html?loc_id=1234"})
{'msg': 'path added'}
path: | The unquoted, utf-8-decoded old path to the location. required Example value: "/old/path/to/location/loc_1234.html" must be an absolute path |
---|
Create/update the path_history of the location.
This resource creates/replaces the path_history of the location.
Set the path history of a location:
>>> PUT("/123/locations/799d6c73-fe75-11df-837b-001ec21bff9e/path_history",
... {'items': [{"path": "/location.php?id=1234"},
... {"path": "/locations/index.html?item=54321&show_details=1"}]})
{'msg': 'path history updated'}
Remove a location's path history:
>>> PUT("/123/locations/799d6c73-fe75-11df-837b-001ec21bff9e/path_history",
... {'items': []})
{'msg': 'path history updated'}
items: | required Every element of the list is a dictionary, each consisting of the following fields:
|
---|