Proxies

Proxies

The Proxies resource is the primary way of publishing and managing reverse proxy sites within the platform

Proxy Model

Proxy object

A proxy object contains the following fields

Attribute

Type

Description

id

integer

unique id of the proxy

business_id

integer

Reference id to the Business this proxy is under

user_id

integer

Reference id to the User that created this proxy

domain

string

The hostname/domain where the proxy is published

source_domain

string

The URL without including the path of the site you want to proxy

deleted

boolean

Field that denotes if the proxy is disabled or not

https

boolean

Toggle for enabling SSL for the proxy

extra_css

string

Extra CSS to add to all the proxy's pages

footer_code

string

Extra HTML to add to all the proxy's pages right before the ending </body> tag

header_code

string

Extra HTML to add to all the proxy's pages right before the ending </head> tag

added

timestamp

Date and time proxy was created

modified

timestamp

Date and time proxy was modified

ssl_last_updated

string

Timestamp of when the proxy's SSL was last updated

custom_fields

object

Custom field values assigned to the site

Example object:

{
"added": "2016-12-07T19:20:26",
"aliases": [],
"autolink": false,
"business": {
... fully expanded `Business` object
},
"business_id": 12345,
"cache_html": false,
"country": "US",
"custom_fields": {
"campaign_id": "GA12345"
},
"deleted": false,
"disable_analytics_events": ["form-submit"],
"domain": "www.yourproxydomain.com",
"extra_css": ".body { background-color: red }",
"filter_querystring": true,
"footer_code": "<script>...</script>",
"formatted_url": "http://www.yourproxydomain.com/",
"gtm_id": 'ABG456',
"header_code": "<meta .../>",
"https": false,
"id": 54321,
"ignored_numbers": [],
"image_replacements": [
{
"image_id": 654321,
"image_path": "/assets/some-image.jpg"
}
],
"include_jquery": "1.11.0",
"modified": "2017-03-20T13:42:10",
"number_replacements": [
{
"new_number": "206-777-7777",
"number": "206-555-5555"
},
{
"new_number": "206-999-9999",
"number": "206-666-6666"
}
],
"partner_proxy_category_id": null,
"partner_proxy_id": null,
"partner_proxy_sub_id": null,
"phone": null,
"preview_url": "http://www.yourproxydomain.com.yourwhitelabel.cloudbackend.net/",
"replace_patterns": [
{
"string_to_replace": "Shop today",
"replacement_string": "Shop tomorrow"
}
],
"resource_uri": "/api/v2/proxies/54321/",
"source_domain": "http://www.customerdomain.com",
"ssl_last_updated": null,
"user_id": 1234
}

List proxies

List all proxies including active, deleted, non-published and published

GET /api/v2/proxies/

List all active proxies

GET /api/v2/proxies/?deleted=0

Parameters

Name

Type

Description

business_id

string

Filter for proxies associated with a particular Business

deleted

string

Return proxies based on if they are active (0) or deleted/disabled (1)

formatted_domain

string

Searching by domain/subdomain similar to how you pass formatted_domain on Proxy creation

partner_proxy_id

string

Used to lookup/search for proxies matching a particular internal id

Response

{
"meta":{
"limit":20,
"next":null,
"offset":0,
"previous":null,
"total_count":1
},
"objects":[
{
"added": "2016-07-26T19:39:18",
"autolink": false,
"base_directory": "/",
"business_id": 24305,
"country": "US",
"deleted": false,
"domain": "someproxy.cloudbackend.net",
"extra_css": null,
"footer_code": null,
"header_code": null,
"https": false,
"id": 12345,
"modified": "2016-07-26T19:39:18",
"partner_proxy_id": null,
"phone": "(206) 555-5555",
"replace_patterns": [],
"resource_uri": "/api/v2/proxies/12345/",
"source_domain": "http://www.example.com",
"theme_settings": {},
"user_id": 123
},
{
"added": "2016-07-26T19:39:18",
"autolink": false,
"base_directory": "/",
"business_id": 24305,
"country": "US",
"deleted": false,
"domain": "anotherproxy.cloudbackend.net",
"extra_css": null,
"footer_code": null,
"header_code": null,
"https": false,
"id": 12346,
"modified": "2016-07-26T19:39:18",
"partner_proxy_id": null,
"phone": "(206) 555-5555",
"replace_patterns": [],
"resource_uri": "/api/v2/proxies/12346/",
"source_domain": "http://www.example.com",
"theme_settings": {},
"user_id": 123
},
...
]
}

Get a single proxy

Fetch the Proxy detail using the Proxy.id

GET /api/v2/proxies/:id/

Response

{
"added": "2016-07-26T19:39:18",
"autolink": false,
"base_directory": "/",
"business": {
... fully expanded `Business` object
},
"business_id": 24305,
"country": "US",
"deleted": false,
"disable_cache": false,
"domain": "someproxy.cloudbackend.net",
"extra_css": null,
"footer_code": null,
"header_code": null,
"https": false,
"id": 12345,
"modified": "2016-07-26T19:39:18",
"partner_proxy_id": null,
"phone": "(206) 555-5555",
"replace_patterns": [],
"resource_uri": "/api/v2/proxies/12345/",
"source_domain": "http://www.example.com",
"theme_settings": {},
"user_id": 123
}

Create a proxy

POST /api/v2/proxies/

Parameters

Name

Type

Description

domain

string

required

source_domain

string

required Full URL of the source site (i.e. http://www.example.com). Supports http and https schemas

user_id or partner_user_id

integer or string

required If you know the user account you want to publish this proxy on the behalf of, use user_id. If you don't know the user ID, you can use the partner_user_id method described further down this document.

Optional

base_directory

string

Under private labels with sub-directory based proxies, this is where it is defined (defaults to slash / but an example might be /some-page/)

Example

{
"domain": "someproxy.cloudbackend.net",
"source_domain": "http://www.example.com",
"user_id": 1
}

Response

A status code of 201 created is returned on a successful creation and contains the created proxy object as JSON. See the Get a single proxy section for an example Proxy object.

Updating a proxy

PUT /api/v2/proxies/:id/

You can PUT a partial or full object to the detail endpoint to update/change values on the Proxy object. If using a partial object, you must insure that the primary proxy id is part of the payload.

Disabling / enabling a proxy

Disabling a proxy

To disable an active proxy and clear all cache references to the domain, use the DELETE method on the Proxy detail endpoint.

DELETE /api/v2/proxies/:id/

Enabling a proxy

To enable a currently disabled proxy, you will set the param for deleted to False using the Proxy update endpoint.