Difference between revisions of "Clients"

From Advice Local Wiki
Jump to: navigation, search
(The Client Object)
(The Client Object)
Line 117: Line 117:
 
|-
 
|-
 
|years
 
|years
|string
+
|integer
 
|4
 
|4
 
|optional
 
|optional

Revision as of 12:43, 15 December 2017

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.
owner string 128 optional The business owner's name.
street string 128 required The business street.
suite string 32 optional The business suite.
hours string arbitrary optional The business hours.
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.
phone string 32 required The business phone number.
phoneAlt string 32 optional The business additional phone number.
fax string 32 optional The business fax number.
website string 255 optional The business website.
email string 128 optional The business email address.
facebook string 255 optional The business facebook url.
twitter string 255 optional The business twitter url.
linkedin string 255 optional The business linkedIn url.
years integer 4 optional Number of years in business.
description string arbitrary required The business description.
payment string 255 optional Payment types accepted by the business.
license string 64 optional The business license.
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.
notes string arbitrary optional Internal notes about the business.
custom1 string 64 optional The custom1 is an internal field and replaces fkc1 in API Version 1.
custom2 string 64 optional The custom2 is an internal field and replaces fkc2 in API Version 1.
custom3 string 64 optional The custom3 is an internal field and replaces fkc3 in API Version 1.
custom4 string 64 optional The custom4 is an internal field and replaces fkc4 in API Version 1.
custom5 string 64 optional The custom5 is an 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. View the 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).
deleted boolean readonly Flag indicating whether the client is deleted.
isInactive boolean readonly Flag indicating whether the client is inactive.
createdAt timestamp readonly Time at which the object was created.
deletedAt timestamp readonly Time at which the object was deleted.
inactiveAt timestamp readonly Time at which the object was inactive.
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
transactionId string readonly

Create a Client

API Endpoint

http://p.lssdev.com/legacyclients

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

Example Response

{
    "status": 200,
    "success": true,
    "error": null,
    "data": {
        "status": "Inactive",
        "country": "US",
        "id": 12345,
        "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

API Endpoint

http://p.lssdev.com/legacyclients/{client_id}

Example Request

GET /legacyclients/12345 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": "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

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

API Endpoint

http://p.lssdev.com/legacyclients/{client_id}

Example Request

POST /legacyclients/12345 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": 12345,
        "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

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/12345 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": 12345
        }
    ]
}

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}

Valid {tag} are:

"logo" for Business Logo

"facebook_cover" for Facebook Cover Image

"google_cover" for Google Cover Image

"twitter_cover" for Twitter Cover Image

Example Request

POST /legacyclientimages/12345/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": 12345
        }
    ]
}

Get all Images

API Endpoint

http://p.lssdev.com/legacyclientimages/{client_id}

Example Request

GET /legacyclientimages/12345 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/12345/advice-interactive-group-logo.png",
            "thumbnail": "https://s3.amazonaws.com/p.assets.lssdev.com/client_images/3/7/6/2/a/12345/thumb_advice-interactive-group-logo.png"
        },
        "facebook": {
            "original": "https://s3.amazonaws.com/p.assets.lssdev.com/client_images/3/7/6/2/a/12345/58072_116591211739965_4216445_n.jpg",
            "thumbnail": "https://s3.amazonaws.com/p.assets.lssdev.com/client_images/3/7/6/2/a/12345/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/12345/test-image.png",
            "thumbnail": "https://s3.amazonaws.com/p.assets.lssdev.com/client_images/3/7/6/2/a/12345/thumb_test-image.png"
        },
        "gallery_image_2": {
            "original": "https://s3.amazonaws.com/p.assets.lssdev.com/client_images/3/7/6/2/a/12345/mckinney-local-seo-company.jpg",
            "thumbnail": "https://s3.amazonaws.com/p.assets.lssdev.com/client_images/3/7/6/2/a/12345/thumb_mckinney-local-seo-company.jpg"
        }
    }
}

Delete an Image

API Endpoint

http://p.lssdev.com/legacyclientimages/{client_id}/{image_name}

Example Request

DELETE /legacyclientimages/12345/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": 12345
        }
    ]
}