Difference between revisions of "Clients"
Jdmaldonado (talk | contribs) (→hoursObject) |
Jdmaldonado (talk | contribs) (→hoursObject) |
||
Line 407: | Line 407: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | Client '''hoursObject''' must be submitted as a JSON object consisting in an array of periods. | + | Client '''hoursObject''' must be submitted as a JSON object consisting in an array of periods. Here is the general format required: |
− | |||
<syntaxhighlight lang="json"> | <syntaxhighlight lang="json"> | ||
{ | { |
Revision as of 13:54, 16 July 2019
Contents
The Client Object
The client object represents a business entity. The API allows you to create, update, and delete your clients. You can upload images and order products with a client object.
IMPORTANT - We only support printable ASCII. All unicode characters will be stripped out.
Attribute | Type | Length | Required | Description |
---|---|---|---|---|
id | integer | Unique identifier for the object. | ||
name | string | 128 | required | The busniess name. |
street | string | 128 | required | The business street. |
suite | string | 32 | optional | The business suite. |
city | string | 128 | required | The business city. |
state | string | 64 | required | The business state. |
zipcode | string | 32 | required | The business zipcode. |
country | string | 128 | optional | The business country. |
owner | string | 128 | optional | The business owner's name. |
string | 128 | optional | The business email address. | |
phone | string | 32 | required | The business phone number. |
fax | string | 32 | optional | The business fax number. |
phoneAlt | string | 32 | optional | The business additional phone number. |
website | string | 255 | optional | The business website. |
years | integer | 4 | optional | Number of years in business. |
license | string | 64 | optional | The business license. |
payment | string | 255 | optional | Payment types accepted by the business. |
services | string | 255 | optional | Services offered by the business. |
description | string | arbitrary | required | The business description. |
hours | string | arbitrary | optional | The business hours in open format. See "Field Restrictions" below. |
hoursObject | json | arbitrary | optional | The business hours in structured format. See "Field Restrictions" below. |
hoursSpecialObject | json | arbitrary | optional | The business special hours in structured format. See "Field Restrictions" below. |
keyword1 | string | 64 | optional | The business keyword 1. |
keyword2 | string | 64 | optional | The business keyword 2. |
keyword3 | string | 64 | optional | The business keyword 3. |
keyword4 | string | 64 | optional | The business keyword 4. |
keyword5 | string | 64 | optional | The business keyword 5. |
keyword1_location | string | 128 | optional | The business keyword1 location. |
keyword2_location | string | 128 | optional | The business keyword2 location. |
keyword3_location | string | 128 | optional | The business keyword3 location. |
keyword4_location | string | 128 | optional | The business keyword4 location. |
keyword5_location | string | 128 | optional | The business keyword5 location. |
string | 255 | optional | The business facebook url. | |
string | 255 | optional | The business twitter url. | |
string | 255 | optional | The business linkedIn url. | |
notes | string | arbitrary | optional | Internal notes about the business. |
custom1 | string | 64 | optional | The custom1 is a internal field and replaces fkc1 in API Version 1. |
custom2 | string | 64 | optional | The custom2 is a internal field and replaces fkc2 in API Version 1. |
custom3 | string | 64 | optional | The custom3 is a internal field and replaces fkc3 in API Version 1. |
custom4 | string | 64 | optional | The custom4 is a internal field and replaces fkc4 in API Version 1. |
custom5 | string | 64 | optional | The custom5 is a internal field and replaces fkc5 in API Version 1. |
extra | json | optional | Additional internal fields. Anything more than five custom fields (custom1, custom2, custom3, custom4, and custom5) can be saved in a json string. E.g. {"brands":"test","products":"test"}} | |
categoryGoogle | string | 255 | optional | The category a client belong to. Only one category is allowed per client. List of categories: https://github.com/adviceinteractivegroup/taxonomy/blob/master/taxonomy.csv |
hide | boolean | optional | Hide the client's address. | |
LAT | string | readonly | The client location latitude. | |
LON | string | readonly | The client location longitude. | |
status | string | readonly | The client status (Active, Inactive, Paused, or Widget Lead). | |
isInactive | boolean | readonly | Flag indicating whether the client is inactive. | |
deleted | boolean | readonly | Flag indicating whether the client is deleted. | |
partner | integer | readonly | Unique identifier for Advice Local partner. The partner can manages one or more clients. | |
partnerUsername | string | readonly | The partner username is used to log into Advice Local Dashboard. | |
publicKey | string | readonly | ||
gmb_token | string | readonly | ||
tokenGoogle | json | readonly | ||
createdAt | timestamp | readonly | Time at which the object was created. | |
inactiveAt | timestamp | readonly | Time at which the object was inactive. | |
deletedAt | timestamp | readonly | Time at which the object was deleted. | |
transactionId | string | readonly |
Create a Client
Creates a new client object.
API Endpoint
http://p.lssdev.com/legacyclients
Field Restrictions
IMPORTANT - We only support printable ASCII. All unicode characters will be stripped out.
hours
The time periods that this client is open for business. Client hours is in open format.
Monday 7:30am-4:30pm, Tuesday 7:30am-4:30pm, Wednesday 9:00am-6:00pm, Thursday 7:30am-4:30pm, Friday 7:30am-4:30pm, Saturday 12:15pm-1:30pm, Sunday Closed
hoursObject
The time periods that this client is open for business. Each open day can consist of one or several periods, as well as to be open 24 hours for said date.
Each period is a JSON object with the following structure:
{
"openDay": "",
"openTime": "",
"closeDay": "",
"closeTime": "",
}
In the following period, the client is open Monday from 9am to 5pm:
{
"openDay": "MONDAY",
"openTime": "09:00",
"closeDay": "MONDAY",
"closeTime": "17:00",
}
In the following period, the client is open 24 hours on Monday :
{
"openDay": "MONDAY",
"openTime": "00:00",
"closeDay": "TUESDAY",
"closeTime": "00:00",
}
Client hoursObject must be submitted as a JSON object consisting in an array of periods. Here is the general format required:
{
"periods": [
{
"openDay": "MONDAY",
"openTime": "08:00",
"closeDay": "MONDAY",
"closeTime": "19:00",
},
{...},
{...},
]
}
In the following example, the client is open during these periods: Monday from 8am to 7pm. Tuesday from 8 am to 12pm and then again from 2pm to 7pm. Wednesday is open 24 hours. Thursday from 8am to 12pm and then again from 2pm to 10pm. Friday from 8am to 10pm.
and Wednesday from 8am to 7pm, Thursday from 8am to 12pm and then again from 1pm to 7pm, and then Friday from 8am to 7pm.
{
"periods": [
{
"openDay": "MONDAY",
"openTime": "08:00",
"closeDay": "MONDAY",
"closeTime": "19:00",
},
{
"openDay": "TUESDAY",
"openTime": "08:00",
"closeDay": "TUESDAY",
"closeTime": "12:00",
},
{
"openDay": "TUESDAY",
"openTime": "14:00",
"closeDay": "TUESDAY",
"closeTime": "19:00",
},
{
"openDay": "WEDNESDAY",
"openTime": "00:00",
"closeDay": "THURSDAY",
"closeTime": "00:00",
},
{
"openDay": "THURSDAY",
"openTime": "08:00",
"closeDay": "THURSDAY",
"closeTime": "12:00",
},
{
"openDay": "THURSDAY",
"openTime": "14:00",
"closeDay": "THURSDAY",
"closeTime": "22:00",
},
{
"openDay": FRIDAY,
"openTime": 08:00,
"closeDay": FRIDAY,
"closeTime": 22:00,
}
]
}
Take into consideration periods shouldn't overlap between each other.
hoursSpecialObject
The time periods that differ from the client normal business hours. Client hoursSpecialObject must be submitted as a JSON object. Here is the format required for the JSON object.
{
"specialHourPeriods": [
{
"startDate": {
"year": 2015,
"month": 11,
"day": 23
},
"openTime": 08:00,
"endDate": {
"year": 2015,
"month": 11,
"day": 23
},
"closeTime": 18:00
},
{...},
{...},
]
}
categoryGoogle
Client can only have one category. You can get the category at https://github.com/adviceinteractivegroup/taxonomy/blob/master/taxonomy.csv. Look for the part after "gcid:" in the taxonomy.csv file, so if it is "gcid:resturants", then you need to send in "resturants".
Example Request
POST /legacyclients HTTP/1.1
Host: p.lssdev.com
x-api-token: YOUR_API_KEY
Content-Type: application/x-www-form-urlencoded
name=Gina+Pizza&street=3142+W+Balboa+Blvd&city=Newport+Beach&state=CA&zipcode=92663&phone=(949)+723-4462&categoryGoogle=resturants
Example Response
{
"status": 200,
"success": true,
"error": null,
"data": {
"status": "Inactive",
"country": "US",
"id": 3201926,
"name": "Gina Pizza",
"partnerUsername": "dev@lssdev.com",
"street": "3142 W Balboa Blvd",
"city": "Newport Beach",
"state": "CA",
"zipcode": "92663",
"phone": "(949) 723-4462",
"hide": "false",
"createdAt": "2017-12-12T23:59:44.077Z",
"publicKey": "e343f4531abf70d03706727af93006c8",
"partner": 7
}
}
Get a Client
Retrieves the details of an existing client. You need to supply the unique client identifier.
API Endpoint
http://p.lssdev.com/legacyclients/{client_id}
Example Request
GET /legacyclients/3201926 HTTP/1.1
Host: p.lssdev.com
x-api-token: YOUR_API_KEY
Content-Type: application/json
Example Response
{
"status": 200,
"success": true,
"error": null,
"data": {
"partner": 7,
"gmb_token": null,
"id": 3201926,
"suite": null,
"deleted": "false",
"LAT": null,
"LON": null,
"status": "Inactive",
"country": "US",
"orders": 0,
"extra": "",
"name": "Gina's Pizza",
"owner": "",
"partnerUsername": "dev@lssdev.com",
"street": "3142 W Balboa Blvd",
"hours": "",
"city": "Newport Beach",
"state": "CA",
"zipcode": "92663",
"phone": "(949) 723-4462",
"phoneAlt": null,
"fax": "",
"website": "",
"email": "",
"facebook": "",
"twitter": "",
"linkedin": "",
"years": "",
"description": "",
"payment": "",
"services": "",
"license": "",
"keyword1": "",
"keyword2": "",
"keyword3": "",
"keyword4": "",
"keyword5": "",
"keyword1_location": null,
"keyword2_location": null,
"keyword3_location": null,
"keyword4_location": null,
"keyword5_location": null,
"notes": "",
"hide": "false",
"isInactive": false,
"createdAt": "2017-12-12T23:59:44.000Z",
"deletedAt": null,
"inactiveAt": null,
"custom1": "",
"custom2": "",
"custom3": "",
"custom4": "",
"custom5": "",
"publicKey": "e343f4531abf70d03706727af93006c8",
"tokenGoogle": null,
"categoryGoogle": null,
"transactionId": "4cd877f9-d339-4ee4-8de6-d4dd168f017c"
}
}
Getting SSO Url
This endpoint retrieves an SSL-secured URL for any client in a partner dashboard that can be view report/progress information without logging in.
API Endpoint
http://p.lssdev.com/legacyclients/{client_id}/sso
Example Request
GET /legacyclients/3201926/sso HTTP/1.1
Host: p.lssdev.com
x-api-token: YOUR_API_KEY
Content-Type: application/json
Example Response
{
"status": 200,
"success": true,
"error": null,
"data": "https://mysite.advicelocal.com/?page=site/clients/monthly-progress&client_id=3201926&lss_token=c1c55a63"
}
Get all Clients
Returns a list of your clients.
API Endpoint
http://p.lssdev.com/legacyclients
Example Request
GET /legacyclients HTTP/1.1
Host: p.lssdev.com
x-api-token: YOUR_API_KEY
Content-Type: application/json
Example Request with Parameters
See Parameters list below.
GET /legacyclients?limit=30 HTTP/1.1
Host: p.lssdev.com
x-api-token: YOUR_API_KEY
Content-Type: application/json
Cache-Control: no-cache
Example Response
{
"status": 200,
"success": true,
"error": null,
"data": [
{
"partner": 7,
"gmb_token": null,
"id": 12345,
"suite": null,
"deleted": "true",
"LAT": 0,
"LON": 0,
"status": "Paused",
"country": "US",
"orders": 0,
"extra": "",
"name": "",
"owner": "",
"partnerUsername": "dev@lssdev.com",
"street": "2060 Broadway St",
"hours": "",
"city": "Boulder",
"state": "CO",
"zipcode": "80302",
"phone": "(303) 444-8840",
"phoneAlt": "",
"fax": "",
"website": "http://www.danday.com/?cmpid=loc3",
"email": "",
"facebook": "",
"twitter": "",
"linkedin": "",
"years": "",
"description": "",
"payment": "",
"services": "",
"license": "",
"keyword1": "",
"keyword2": "",
"keyword3": "",
"keyword4": "",
"keyword5": "",
"keyword1_location": null,
"keyword2_location": null,
"keyword3_location": null,
"keyword4_location": null,
"keyword5_location": null,
"notes": "",
"hide": "false",
"isInactive": true,
"createdAt": "2014-03-25T11:24:15.000Z",
"deletedAt": "2015-02-17T17:48:43.000Z",
"inactiveAt": null,
"custom1": "",
"custom2": "",
"custom3": "",
"custom4": "",
"custom5": "",
"publicKey": "cb7e1c2ca63629c169f5937be15066c6",
"tokenGoogle": null,
"categoryGoogle": ""
},
{
"partner": 7,
"gmb_token": null,
"id": 67890,
"suite": null,
"deleted": "true",
"LAT": 0,
"LON": 0,
"status": "Paused",
"country": "US",
"orders": 0,
"extra": "",
"name": "Crosswind Advisors",
"owner": "Kurt Wanner",
"partnerUsername": "dev@lssdev.com",
"street": "19125 N Creek Pkwy, Suite 120",
"hours": "",
"city": "Bothell",
"state": "WA",
"zipcode": "098011",
"phone": "(425) 349-2527",
"phoneAlt": "",
"fax": "(425) 645-7870",
"website": "www.crosswindadvisors.com",
"email": "kurt@crosswindadvisors.com",
"facebook": "",
"twitter": "",
"linkedin": "",
"years": "",
"description": "",
"payment": "",
"services": "",
"license": "",
"keyword1": "",
"keyword2": "",
"keyword3": "",
"keyword4": "",
"keyword5": "",
"keyword1_location": null,
"keyword2_location": null,
"keyword3_location": null,
"keyword4_location": null,
"keyword5_location": null,
"notes": "",
"hide": "false",
"isInactive": true,
"createdAt": "2014-04-21T18:44:29.000Z",
"deletedAt": "2015-02-17T17:48:43.000Z",
"inactiveAt": null,
"custom1": "",
"custom2": "",
"custom3": "",
"custom4": "",
"custom5": "",
"publicKey": "f114082b24a58fd061f9f96b277a40f5",
"tokenGoogle": null,
"categoryGoogle": ""
},
{...},
{...}
],
"total": 20
}
Parameters
Parameter | Value | Description | Parameter Type | Data Type |
---|---|---|---|---|
where | (empty) | JSON encode WHERE criteria objects. Example: where={"name":{"contains":"theodore"}} | query | string |
limit | 20 | The maximum number of records to send back. Example: limit=100 | query | integer |
skip | 0 | The number of records to skip. Example: skip=30 | query | integer |
sort | id ASC | The sort order. Example: sort=lastName%20ASC | query | string |
callback | (empty) | If specified, a JSONP response will be sent (instead of JSON). This is the name of a client-side javascript function to call, to which results will be passed as the first (and only) argument. Example: ?callback=my_JSONP_data_receiver_fn | query | string |
businessName | (empty) | query | string | |
city | (empty) | query | string | |
street1 | (empty) | query | string | |
street2 | (empty) | query | string | |
state | (empty) | query | string | |
postal | (empty) | query | string | |
country | US (default), GB, CA, AU, DE, or NZ | query | string | |
website | (empty) | query | string | |
hours | (empty) | query | string | |
description | (empty) | query | string | |
hide | true or false | query | boolean | |
phone | (empty) | query | string | |
fax | (empty) | query | string | |
(empty) | query | string | ||
owner | (empty) | query | string | |
isActive | true or false | query | boolean | |
isDeleted | true or false | query | boolean | |
clientId | (empty) | query | long | |
legacyClient | (empty) | query | string | |
LAT | (empty) | query | undefined | |
LON | (empty) | query | undefined | |
agency | (empty) | query | string | |
category | (empty) | query | string | |
categories | (empty) | query | string | |
keywords | (empty) | query | Array[string] | |
socials | (empty) | query | Array[string] | |
competitors | (empty) | query | Array[string] | |
reportingLists | (empty) | query | Array[string] | |
links | (empty) | query | Array[string] | |
submissions | (empty) | query | string | |
custom1 | (empty) | query | string | |
custom2 | (empty) | query | string | |
custom3 | (empty) | query | string | |
custom4 | (empty) | query | string | |
custom5 | (empty) | query | string | |
status | (empty) | query | string | |
tokenGoogle | (empty) | query | string | |
id | (empty) | query | string | |
createdAt | (empty) | query | date-time | |
updatedAt | (empty) | query | date-time |
Update a Client
Updates the specified client. This endpoint accepts the same parameters as the [Add a Client] endpoint. Any parameters not provided will be left unchanged.
API Endpoint
http://p.lssdev.com/legacyclients/{client_id}
Example Request
POST /legacyclients/3201926 HTTP/1.1
Host: p.lssdev.com
x-api-token: YOUR_API_KEY
Content-Type: application/x-www-form-urlencoded
name=Gina's+Pizza&street=3142+W+Balboa+Blvd&city=Newport+Beach&state=CA&zipcode=92663&phone=(949)+723-4462
Example Response
{
"status": 200,
"success": true,
"error": null,
"data": {
"id": 3201926,
"suite": null,
"deleted": "false",
"LAT": null,
"LON": null,
"status": "Inactive",
"country": "US",
"orders": 0,
"extra": "",
"name": "Gina's Pizza",
"owner": "",
"partnerUsername": "dev@lssdev.com",
"street": "3142 W Balboa Blvd",
"hours": "",
"city": "Newport Beach",
"state": "CA",
"zipcode": "92663",
"phone": "(949) 723-4462",
"phoneAlt": null,
"fax": "",
"website": "",
"email": "",
"facebook": "",
"twitter": "",
"linkedin": "",
"years": "",
"description": "",
"payment": "",
"services": "",
"license": "",
"keyword1": "",
"keyword2": "",
"keyword3": "",
"keyword4": "",
"keyword5": "",
"keyword1_location": null,
"keyword2_location": null,
"keyword3_location": null,
"keyword4_location": null,
"keyword5_location": null,
"notes": "",
"hide": "false",
"isInactive": false,
"createdAt": "2017-12-12T23:59:44.000Z",
"deletedAt": null,
"inactiveAt": null,
"custom1": "",
"custom2": "",
"custom3": "",
"custom4": "",
"custom5": "",
"publicKey": "e343f4531abf70d03706727af93006c8",
"tokenGoogle": null,
"categoryGoogle": null,
"partner": 7,
"gmb_token": null
}
}
Client Images
Upload images for the specified client.
Add an Image
This endpoint will upload images to the "Gallery Images" section of the Dashboard. Image name will be automatically saved as "gallery_image_1", "gallery_image_2", "gallery_image_3", "gallery_image_4", and "gallery_image_5".
API Endpoint
http://p.lssdev.com/legacyclientimages/{client_id}
Example Request
POST /legacyclientimages/3201926 HTTP/1.1
Host: p.lssdev.com
x-api-token: YOUR_API_KEY
Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW
------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="image"; filename="test-image.png"
Content-Type: image/png
------WebKitFormBoundary7MA4YWxkTrZu0gW--
Example Response
{
"status": 200,
"success": true,
"error": null,
"data": [
{
"imageArray": "test-image.png",
"imageObject": "{}",
"client": 3201926
}
]
}
Add an Image with a Tag
This endpoint will upload images to the "Client Images" of the Dashboard. These images are for Business Logo, Google Cover Image, Facebook Cover Image, and Twitter Cover Image. Image name will be saved as "logo" for Business Logo, "google" for Google Cover Image, "facebook" for Facebook Cover Image, and "twiiter" for Twitter Cover Image.
API Endpoint
http://p.lssdev.com/legacyclientimages/{client_id}/{tag}
Replace {tag} with:
1. "logo" for Business Logo
2. "facebook_cover" for Facebook Cover Image
3. "google_cover" for Google Cover Image
4. "twitter_cover" for Twitter Cover Image
Example Request
POST /legacyclientimages/3201926/logo HTTP/1.1
Host: p.lssdev.com
x-api-token: YOUR_API_KEY
Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW
------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="image"; filename="advice-interactive-group-logo.png"
Content-Type: image/png
------WebKitFormBoundary7MA4YWxkTrZu0gW--
Example Response
{
"status": 200,
"success": true,
"error": null,
"data": [
{
"imageArray": "test-image.png|mckinney-local-seo-company.jpg",
"imageObject": "{\"logo\":\"advice-interactive-group-logo.png\"}",
"client": 3201926
}
]
}
Get all Images
Returns a list of the client images.
API Endpoint
http://p.lssdev.com/legacyclientimages/{client_id}
Example Request
GET /legacyclientimages/3201926 HTTP/1.1
Host: p.lssdev.com
x-api-token: YOUR_API_KEY
Content-Type: application/json
Example Response
{
"status": 200,
"success": true,
"error": null,
"data": {
"logo": {
"original": "https://s3.amazonaws.com/p.assets.lssdev.com/client_images/3/7/6/2/a/3201926/advice-interactive-group-logo.png",
"thumbnail": "https://s3.amazonaws.com/p.assets.lssdev.com/client_images/3/7/6/2/a/3201926/thumb_advice-interactive-group-logo.png"
},
"facebook": {
"original": "https://s3.amazonaws.com/p.assets.lssdev.com/client_images/3/7/6/2/a/3201926/58072_116591211739965_4216445_n.jpg",
"thumbnail": "https://s3.amazonaws.com/p.assets.lssdev.com/client_images/3/7/6/2/a/3201926/thumb_58072_116591211739965_4216445_n.jpg"
},
"gallery_image_1": {
"original": "https://s3.amazonaws.com/p.assets.lssdev.com/client_images/3/7/6/2/a/3201926/test-image.png",
"thumbnail": "https://s3.amazonaws.com/p.assets.lssdev.com/client_images/3/7/6/2/a/3201926/thumb_test-image.png"
},
"gallery_image_2": {
"original": "https://s3.amazonaws.com/p.assets.lssdev.com/client_images/3/7/6/2/a/3201926/mckinney-local-seo-company.jpg",
"thumbnail": "https://s3.amazonaws.com/p.assets.lssdev.com/client_images/3/7/6/2/a/3201926/thumb_mckinney-local-seo-company.jpg"
}
}
}
Delete an Image
Delete the client images.
API Endpoint
http://p.lssdev.com/legacyclientimages/{client_id}/{image_name}
Replace {image_name} with the returned [Get all Images] name.
Example Request
DELETE /legacyclientimages/3201926/gallery_image_2 HTTP/1.1
Host: p.lssdev.com
x-api-token: YOUR_API_KEY
Content-Type: application/json
Example Response
{
"status": 200,
"success": true,
"error": null,
"data": [
{
"imageArray": "test-image.png",
"imageObject": "{\"logo\":\"advice-interactive-group-logo.png\",\"facebook\":\"58072_116591211739965_4216445_n.jpg\"}",
"client": 3201926
}
]
}