Clients

From Advice Local Wiki
Revision as of 00:14, 16 December 2017 by Psu (talk | contribs) (Example Response)
Jump to: navigation, search

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.

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.
email 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.
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.
facebook string 255 optional The business facebook url.
twitter string 255 optional The business twitter url.
linkedin 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

hours

Client hours can be submitted as a text string (ie: "Monday through Friday, 9am - 5pm") or as a JSON object. Here is the format required for the JSON object.

{
	"1":{
		"days":"Monday,Tuesday,Wednesday",
		"1":{
			"start":"8:00 AM",
			"end":"5:00 PM"
		}
	}
	"2":{
		"days":"Thursday",
		"1":{
			"start":"9:00 AM",
			"end":"12:00 PM"
		},
		"2":{
			"start":"1:00 PM",
			"end":"5:00 PM"
		}
	}
	"3":{
		"days":"Friday",
		"1":{
			"start":"8:00 AM",
			"end":"4:00 PM"
		}
	}
}

In the following example, the client is open Monday, Tuesday and Wednesday from 9am to 5pm, Thursday from 9am to 12pm and then again from 1pm to 5pm, and then Friday from 8am to 4pm.

DAY BLOCKS: You may have a max of 10 "day blocks" and a max of 5 "hour blocks" for a single "day block".

1) Monday, Tuesday, Wednesday

HOUR BLOCK: 1) 8am - 5pm

2) Thursday

HOUR BLOCK: 1) 9am - 12pm
            2) 1pm - 5pm

3) Friday

HOUR BLOCK: 1) 8am - 5pm

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"
    }
}

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 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
}

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
        }
    ]
}