You are on page 1of 73

TOFFS API USER MANUAL

Document Title : Toffs API User Manual


Classification : Commercial-in-Confidence
Status : Release
Written By : Zhang Jun
Reviewed & Approved By :
Document Owner : Toffs Technologies Pte Ltd
Creation Date : 20 June 2019
Issue Date : 20 June 2019
Version 1.0
June 2019

DOCUMENT HISTORY
Version Revision Details
Author Zhang Jun
Designation Senior Development Lead
Revision Date June 20, 2019
Summary of
Revisi
o
1.0 n
Reviewer
Designation
Review Date
Version Status
Approver
Designation
Approval Date

© 2019 Toffs Technologies Pte Ltd


Commercial-In-Confidential
Version 1.0
June 2019

Table of Contents
OVERVIEW ................................................................................................................................................7
Introduction................................................................................................................................................................................................ 7
Purpose Getting Started .............................................................................................................................................................................7
1.4.1 Endpoints .................................................................................................................................................................................... 8
1.4.2 Requests ..................................................................................................................................................................................... 8
1.4.3 Required parameters ..................................................................................................................................................................8
1.4.4 Responses (Example) ..................................................................................................................................................................8
1.4.5 Error Code................................................................................................................................................................................... 9
1.4.6 Error Response (Example)........................................................................................................................................................... 9
1.4.7 HTTP Content-Type : application/json ........................................................................................................................................9

DATA STRUCTURE................................................................................................................................... 10
2.1 PAD Object definitions .......................................................................................................................................................................10

PAD APIS................................................................................................................................................. 11
3.1 Create new PAD API ..................................................................................................................................................................11
3.2 Get Pad API ............................................................................................................................................................................... 12
3.3 Get PADs List.............................................................................................................................................................................13
3.4 Get Pad Detail Info API ............................................................................................................................................................. 15
3.5 Update PAD Detail ....................................................................................................................................................................16
3.6 Update PAD SSL API ..................................................................................................................................................................18
3.7 Get PAD Challenge Detail API ..................................................................................................................................................... 19
3.8 Update PAD Challenge Detail API ............................................................................................................................................... 20
3.9 Get Proxy Set Header Host ....................................................................................................................................................... 21
3.10 Update Proxy Set Header Host................................................................................................................................................... 21
3.11 Get Proxy Hide Header ............................................................................................................................................................. 22
3.12 Update Proxy Hide Header ....................................................................................................................................................... 22
3.13 Get Customize Header .............................................................................................................................................................. 23
3.14 Update Customize Header ........................................................................................................................................................ 23
3.15 Get Origin Request Uri .............................................................................................................................................................. 24
3.16 Update Origin Request Uri ......................................................................................................................................................... 24
3.17 Get Force to WWW...................................................................................................................................................................25
3.18 Update Force to WWW ............................................................................................................................................................. 26
3.19 Get Cache Details ......................................................................................................................................................................26
3.20 Update Cache Details ................................................................................................................................................................ 27
3.21 Get CORS Details .......................................................................................................................................................................28
3.22 Update CORS Details .................................................................................................................................................................28
3.23 Get GZip Details ........................................................................................................................................................................29
3.24 Update GZip Details ...................................................................................................................................................................30
3.25 Get IP Whitelist(Bypass) ........................................................................................................................................................... 30
3.26 Update IP Whitelist(Bypass)....................................................................................................................................................... 31
© 2019 Toffs Technologies Pte Ltd
Commercial-In-Confidential
Version 1.0
June 2019
3.27 Get Geo IPs ............................................................................................................................................................................... 32
3.28 Update Geo IPs..........................................................................................................................................................................32
3.29 Get Geo Country .......................................................................................................................................................................33
3.30 Update Geo Country..................................................................................................................................................................34
3.31 Get Max Number of Connections .............................................................................................................................................35
3.32 Update Max Number of Connections .......................................................................................................................................35
3.33 Get IP+Path Rate Limiting ......................................................................................................................................................... 36
3.34 Add IP+Path Rate Limiting ........................................................................................................................................................ 36
3.35 Remove IP+Path Rate Limiting .................................................................................................................................................. 37
3.36 Get Origin failover Details ......................................................................................................................................................... 38
3.37 Update Origin failover Details .................................................................................................................................................... 38
3.38 Get SSL TLS Protocol .................................................................................................................................................................39
3.39 Update SSL TLS Protocol ............................................................................................................................................................ 40
3.40 Get SSL Cipher List ....................................................................................................................................................................41
3.41 Update SSL Cipher List ............................................................................................................................................................... 41
3.42 Get Enable Free SSL ..................................................................................................................................................................42
3.43 Update Enable Free SSL ............................................................................................................................................................ 42
3.44 Get Enable Auto Generate SSL .................................................................................................................................................. 43
3.45 Update Enable Auto Generate SSL ...........................................................................................................................................44
3.46 Generate SSL TXT Record.......................................................................................................................................................... 44
3.47 Finalize SSL ................................................................................................................................................................................ 45
3.48 Generate San SSL Certificate .................................................................................................................................................... 46
3.49 SSL Certificate Effective Check .................................................................................................................................................. 46
3.50 Get Disallow Bot .......................................................................................................................................................................47
3.51 Update Disallow Bot .................................................................................................................................................................47
3.52 Get WebSocket .........................................................................................................................................................................48
3.53 Update WebSocket ...................................................................................................................................................................49
3.54 Get Block XFF ............................................................................................................................................................................49
3.55 Update Block XFF ......................................................................................................................................................................50
3.56 Get Secure Link Token .............................................................................................................................................................. 50
3.57 Get Secure Link URL ..................................................................................................................................................................51
3.58 Split PAD ................................................................................................................................................................................... 52
3.59 Get Waf & SecuritySettings ...................................................................................................................................................... 53
3.60 Update Waf & Security Settings ............................................................................................................................................... 54
3.61 PAD release, Stop, Delete ......................................................................................................................................................... 56

HOST(ALIAS) APIS.................................................................................................................................... 57
4.1 Get PAD Detail by Host(Alias) ................................................................................................................................................... 57
4.2 Insert Host(Alias) to PAD alias ................................................................................................................................................. 57
4.3 Delete Host(Alias) from PAD alias ...........................................................................................................................................58

PURGE CACHE ........................................................................................................................................ 58


5.1 Purge by pad .............................................................................................................................................................................58
5.2 Purge by Url ..............................................................................................................................................................................59
© 2019 Toffs Technologies Pte Ltd
Commercial-In-Confidential
Version 1.0
June 2019
5.3 Purge by Brand .........................................................................................................................................................................60
5.4 Purge by Account ......................................................................................................................................................................61
5.5 Purge Cache Status ...................................................................................................................................................................62

GET USER INFO ....................................................................................................................................... 63


6.1 Method .............................................................................................................................................................................................. 63

GET ACCOUNT LIST ................................................................................................................................. 63


7.1 Method ..................................................................................................................................................................................... 63
7.2 Get Brand List By Account......................................................................................................................................................... 64

PAGE RULES ........................................................................................................................................... 65


8.1 Get Page Rules List....................................................................................................................................................................65
8.2 Get Page Rule ...........................................................................................................................................................................66
8.3 Create new Page Rule ............................................................................................................................................................... 67
8.4 Update Page Rule .....................................................................................................................................................................69
8.5 Delete Page Rule .........................................................................................................................................................................4

TOFFS IP List .............................................................................................................................................5


9.1 Get TOFFS IP list ..........................................................................................................................................................................5

© 2019 Toffs Technologies Pte Ltd


Commercial-In-Confidential
Version 1.0
June 2019

© 2019 Toffs Technologies Pte Ltd


Commercial-In-Confidential
Version 1.0
June 2019

OVERVIEW
Introduction
The Toffs API is a RESTful API based on HTTPS requests and JSON responses. If
you are registered with Toffs , you can obtain your API key from the bottom of the "My
Account" page.

Purpose
Getting Started
The Toffs API is a RESTful API based on HTTPS requests and JSON responses. If
you are registered with Toffs , you can obtain your API key from the bottom of the "My
Account" page:

1.3.1 Retrieve API Token

1. Login to Toffs CDN Portal (https://portal.toffstech.com/user/profile) ,Go to "My


Profile".

2. Scroll down to the bottom of the page, look for "API Token". Click on "Copy" to
copy the token to your clipboard. To reset the API Token , click on "Reset".

3. Please be noted that upon resetting API Token, all previous token will lose effect
immediately.

© 2019 Toffs Technologies Pte Ltd


Commercial-In-Confidential
Version 1.0
June 2019

API INSTRUCTIONS

1.4.1 Endpoints

https://api.toffstech.com/v1/

1.4.2 Requests

Requests must be sent over HTTPS with any payload formatted in JSON. All requests
must include both and headers to authenticate.

1.4.3 Required parameters

Name Format Description


API Token X-Auth-Token API key generated on the "My Account" page
Email X-Auth-Email Email address associated with your account

1.4.4 Responses (Example)

© 2019 Toffs Technologies Pte Ltd


Commercial-In-Confidential
Version 1.0
June 2019

1.4.5 Error Code

1.4.6 Error Response (Example)

1.4.7 HTTP Content-Type : application/json

The response format can be determined from the HTTP Content-Type header. Most
API responses are JSON (Content-Type: application/json).

© 2019 Toffs Technologies Pte Ltd


Commercial-In-Confidential
Version 1.0
June 2019

DATA STRUCTURE
2.1 PAD Object definitions
Name Type Default Null Constraints
ID Int No Read only
Pad_name String No Max length: 128
Pad_aliases Array Max length: 65,535
Account_id Int
Customer_brand String Max length:100
Upstream_server Array No Max row:100
Created_at String Read only
Ssl_enable Bool false
Ssl_certificate_crt String Max length:65,535
Ssl_certificate_key String Max length:65,535
Ssl_force_redirect Bool false
Status Int 0 read only
"options": { "0":
"Pending",
"1": "Release",
"2": "Published",
"3": "Actived",
"4": "Remove to
Trash","5":
"Stopping",
"6": "Stopped"
}
Upstream_method Int 0 0=Round-robin
1=ip_hash
2=fair
3=least conn
Hsts_includesubdomains Int 0 0=false
1=true
Hsts Int 0 0=false
1=true
Listen_http_ports String 80 Max length:255
Listen_https_ports String 443 Max length:255
Cname String Read-only
http2 Int 1 0=false,1=true
Upstream_scheme String http- Values: Http-Only. Https-
only Only
Proxy_cache_key int 0 0=Standard,
1=Ignorequery string

© 2019 Toffs Technologies Pte Ltd


Commercial-In-Confidential
Version 1.0
June 2019

PAD APIS
3.1 Create new PAD API

Method

POST pad

3.1.1 Required parameters

3.1.2 Optional parameters

3.1.3 cURL (Example)

© 2019 Toffs Technologies Pte Ltd


Commercial-In-Confidential
Version 1.0
June 2019

Return

3.2 Get Pad API

3.2.1 Method

3.2.2 Required parameters

3.2.3 cURL (Example)

© 2019 Toffs Technologies Pte Ltd


Commercial-In-Confidential
Version 1.0
June 2019

Response (Example)

3.3 Get PADs List

3.3.1 Method

3.3.2 Required parameters

3.3.3 Optional parameters

© 2019 Toffs Technologies Pte Ltd


Commercial-In-Confidential
Version 1.0
June 2019

3.3.4 cURL (Example)

Response (Example)

© 2019 Toffs Technologies Pte Ltd


Commercial-In-Confidential
Version 1.0
June 2019

3.4 Get Pad Detail Info API

3.4.1 Method

3.4.2 cURL (Example)

Response

© 2019 Toffs Technologies Pte Ltd


Commercial-In-Confidential
Version 1.0
June 2019

3.5 Update PAD Detail

3.5.1 Method

3.5.2 Optional parameters


© 2019 Toffs Technologies Pte Ltd
Commercial-In-Confidential
Version 1.0
June 2019

3.5.3 cURL (Example)

© 2019 Toffs Technologies Pte Ltd


Commercial-In-Confidential
Version 1.0
June 2019

Response

3.6 Update PAD SSL API

3.6.1 Method

3.6.2 Optional parameters

3.6.3 cURL (Example)

© 2019 Toffs Technologies Pte Ltd


Commercial-In-Confidential
Version 1.0
June 2019

Return

3.7 Get PAD Challenge Detail API

3.7.1 Method

3.7.2 cURL (Example)

Response

© 2019 Toffs Technologies Pte Ltd


Commercial-In-Confidential
Version 1.0
June 2019

3.8 Update PAD Challenge Detail API

3.8.1 Method

3.8.2 Optional parameters

*To update Whitelist, Parameter “captcha_whitelist” and Parameter “captcha_whitelist_edit_type” must be both included.
**Acceptable value:

3.8.3 cURL (Example)

Response

© 2019 Toffs Technologies Pte Ltd


Commercial-In-Confidential
Version 1.0
June 2019

3.9 Get Proxy Set Header Host

3.9.1 Method

3.9.2 cURL (Example)

Response

3.10 Update Proxy Set Header Host

3.10.1 Method

3.10.2 Required parameters

3.10.3 cURL (Example)

Response

© 2019 Toffs Technologies Pte Ltd


Commercial-In-Confidential
Version 1.0
June 2019

3.11 Get Proxy Hide Header

3.11.1 Method

3.11.2 cURL (Example)

Response

3.12 Update Proxy Hide Header

3.12.1 Method

3.12.2 Required parameters

3.12.3 cURL (Example)

© 2019 Toffs Technologies Pte Ltd


Commercial-In-Confidential
Version 1.0
June 2019

Response

3.13 Get Customize Header

3.13.1 Method

3.13.2 cURL (Example)

Response

3.14 Update Customize Header

3.14.1 Method

3.14.2 Required parameters

© 2019 Toffs Technologies Pte Ltd


Commercial-In-Confidential
Version 1.0
June 2019

3.14.3 cURL (Example)

Response

3.15 Get Origin Request Uri

3.15.1 Method

3.15.2 cURL (Example)

Response

3.16 Update Origin Request Uri

© 2019 Toffs Technologies Pte Ltd


Commercial-In-Confidential
Version 1.0
June 2019

3.16.1 Method

3.16.2 Required parameters

3.16.3 cURL (Example)

Response

3.17 Get Force to WWW

3.17.1 Method

3.17.2 cURL (Example)

Response

© 2019 Toffs Technologies Pte Ltd


Commercial-In-Confidential
Version 1.0
June 2019

3.18 Update Force to WWW

3.18.1 Method

3.18.2 Required parameters

3.18.3 cURL (Example)

Response

3.19 Get Cache Details

© 2019 Toffs Technologies Pte Ltd


Commercial-In-Confidential
Version 1.0
June 2019

3.19.1 Method

3.19.2 cURL (Example)

Response

3.20 Update Cache Details

3.20.1 Method

3.20.2 Optional parameters

**Acceptable value:

3.20.3 cURL (Example)

© 2019 Toffs Technologies Pte Ltd


Commercial-In-Confidential
Version 1.0
June 2019

Response

3.21 Get CORS Details

3.21.1 Method

3.21.2 cURL (Example)

Response

3.22 Update CORS Details

© 2019 Toffs Technologies Pte Ltd


Commercial-In-Confidential
Version 1.0
June 2019

3.22.1 Method

3.22.2 Optional parameters

3.22.3 cURL (Example)

Response

3.23 Get GZip Details

3.23.1 Method

3.23.2 cURL (Example)

Response

© 2019 Toffs Technologies Pte Ltd


Commercial-In-Confidential
Version 1.0
June 2019

3.24 Update GZip Details

3.24.1 Method

3.24.2 Optional parameters

**Acceptable value:
gzip_types:

Separate with space.

3.24.3 cURL (Example)

Response

3.25 Get IP Whitelist(Bypass)


© 2019 Toffs Technologies Pte Ltd
Commercial-In-Confidential
Version 1.0
June 2019

3.25.1 Method

3.25.2 cURL (Example)

Response

3.26 Update IP Whitelist(Bypass)

3.26.1 Method

3.26.2 Required parameters

3.26.3 cURL (Example)

Response

© 2019 Toffs Technologies Pte Ltd


Commercial-In-Confidential
Version 1.0
June 2019

3.27 Get Geo IPs

3.27.1 Method

3.27.2 cURL (Example)

Response

3.28 Update Geo IPs

3.28.1 Method

3.28.2 Optional parameters

© 2019 Toffs Technologies Pte Ltd


Commercial-In-Confidential
Version 1.0
June 2019

3.28.3 cURL (Example)

Response

3.29 Get Geo Country

3.29.1 Method

3.29.2 cURL (Example)

Response

© 2019 Toffs Technologies Pte Ltd


Commercial-In-Confidential
Version 1.0
June 2019

3.30 Update Geo Country

3.30.1 Method

3.30.2 Optional parameters

3.30.3 cURL (Example)

Response

© 2019 Toffs Technologies Pte Ltd


Commercial-In-Confidential
Version 1.0
June 2019

3.31 Get Max Number of Connections

3.31.1 Method

3.31.2 cURL (Example)

Response

3.32 Update Max Number of Connections

3.32.1 Method

3.32.2 Required parameters

**Acceptable value:

3.32.3 cURL (Example)

© 2019 Toffs Technologies Pte Ltd


Commercial-In-Confidential
Version 1.0
June 2019

Response

3.33 Get IP+Path Rate Limiting

3.33.1 Method

3.33.2 cURL (Example)

Response

3.34 Add IP+Path Rate Limiting

3.34.1 Method

© 2019 Toffs Technologies Pte Ltd


Commercial-In-Confidential
Version 1.0
June 2019

3.34.2 Optional parameters

3.34.3 cURL (Example)

Response

3.35 Remove IP+Path Rate Limiting

3.35.1 Method

3.35.2 Required parameters

3.35.3 cURL (Example)

© 2019 Toffs Technologies Pte Ltd


Commercial-In-Confidential
Version 1.0
June 2019

Response

3.36 Get Origin failover Details

3.36.1 Method

3.36.2 cURL (Example)

Response

3.37 Update Origin failover Details

3.37.1 Method

© 2019 Toffs Technologies Pte Ltd


Commercial-In-Confidential
Version 1.0
June 2019

3.37.2 Optional parameters

**Acceptable value:

"error" and "timeout" are default settings cannot be removed. Please set multiple "proxy_next_pustream" for
multiple options.

3.37.3 cURL (Example)

Response

3.38 Get SSL TLS Protocol

3.38.1 Method
© 2019 Toffs Technologies Pte Ltd
Commercial-In-Confidential
Version 1.0
June 2019

3.38.2 cURL (Example)

Response

3.39 Update SSL TLS Protocol

3.39.1 Method

3.39.2 Required parameters

**Acceptable value:

Separate with space.

3.39.3 cURL (Example)

Response

© 2019 Toffs Technologies Pte Ltd


Commercial-In-Confidential
Version 1.0
June 2019

3.40 Get SSL Cipher List

3.40.1 Method

3.40.2 cURL (Example)

Response

3.41 Update SSL Cipher List

3.41.1 Method

3.41.2 Required parameters

**Acceptable value:

© 2019 Toffs Technologies Pte Ltd


Commercial-In-Confidential
Version 1.0
June 2019

3.41.3 cURL (Example)

Response

3.42 Get Enable Free SSL

3.42.1 Method

3.42.2 cURL (Example)

Response

3.43 Update Enable Free SSL

© 2019 Toffs Technologies Pte Ltd


Commercial-In-Confidential
Version 1.0
June 2019

3.43.1 Method

3.43.2 Required parameters

3.43.3 cURL (Example)

Response

3.44 Get Enable Auto Generate SSL

3.44.1 Method

3.44.2 cURL (Example)

Response

© 2019 Toffs Technologies Pte Ltd


Commercial-In-Confidential
Version 1.0
June 2019

3.45 Update Enable Auto Generate SSL

3.45.1 Method

3.45.2 Required parameters

3.45.3 cURL (Example)

*“Enable Free SSL” will be turned on automatically when turning on “Enable Auto Generate SSL” via API

Response

3.46 Generate SSL TXT Record

3.46.1 Method

© 2019 Toffs Technologies Pte Ltd


Commercial-In-Confidential
Version 1.0
June 2019

3.46.2 cURL (Example)

Response

3.47 Finalize SSL

3.47.1 Method

3.47.2 cURL (Example)

Response

© 2019 Toffs Technologies Pte Ltd


Commercial-In-Confidential
Version 1.0
June 2019

3.48 Generate San SSL Certificate

3.48.1 Method

3.48.2 cURL (Example)

Response

3.49 SSL Certificate Effective Check

3.49.1 Method

3.49.2 cURL (Example)

Response

© 2019 Toffs Technologies Pte Ltd


Commercial-In-Confidential
Version 1.0
June 2019

3.50 Get Disallow Bot

3.50.1 Method

3.50.2 cURL (Example)

Response

3.51 Update Disallow Bot

3.51.1 Method

3.51.2 Required parameters

© 2019 Toffs Technologies Pte Ltd


Commercial-In-Confidential
Version 1.0
June 2019

3.51.3 cURL (Example)

Response

3.52 Get WebSocket

3.52.1 Method

3.52.2 cURL (Example)

Response

© 2019 Toffs Technologies Pte Ltd


Commercial-In-Confidential
Version 1.0
June 2019

3.53 Update WebSocket

3.53.1 Method

3.53.2 Required parameters

3.53.3 cURL (Example)

Response

3.54 Get Block XFF

3.54.1 Method

3.54.2 cURL (Example)

© 2019 Toffs Technologies Pte Ltd


Commercial-In-Confidential
Version 1.0
June 2019

Response

3.55 Update Block XFF

3.55.1 Method

3.55.2 Required parameters

3.55.3 cURL (Example)

Response

3.56 Get Secure Link Token

3.56.1 Method
© 2019 Toffs Technologies Pte Ltd
Commercial-In-Confidential
Version 1.0
June 2019

3.56.2 Required parameters

3.56.3 Optional parameters

3.56.4 cURL (Example)

Response

3.57 Get Secure Link URL

3.57.1 Method

3.57.2 Required parameters

© 2019 Toffs Technologies Pte Ltd


Commercial-In-Confidential
Version 1.0
June 2019

3.57.3 Optional parameters

3.57.4 cURL (Example)

Response

3.58 Split PAD

3.58.1 Method

3.58.2 Required parameters

© 2019 Toffs Technologies Pte Ltd


Commercial-In-Confidential
Version 1.0
June 2019

3.58.3 cURL (Example)

Response

3.59 Get Waf & SecuritySettings

3.59.1 Method

3.59.2 cURL (Example)

Response
© 2019 Toffs Technologies Pte Ltd
Commercial-In-Confidential
Version 1.0
June 2019

3.60 Update Waf & Security Settings

3.60.1 Method

3.60.2 Required parameters

© 2019 Toffs Technologies Pte Ltd


Commercial-In-Confidential
Version 1.0
June 2019

3.60.3 cURL (Example)

Response

© 2019 Toffs Technologies Pte Ltd


Commercial-In-Confidential
Version 1.0
June 2019

3.61 PAD release, Stop, Delete

3.61.1 Method

3.61.2 Required parameters

**Acceptable value for Status:

*Only Pads whose status are Stopped can be deleted

3.61.3 cURL (Example)

Response

© 2019 Toffs Technologies Pte Ltd


Commercial-In-Confidential
Version 1.0
June 2019

HOST(ALIAS) APIS

4.1 Get PAD Detail by Host(Alias)

4.1.1 Method

4.1.2 cURL (example)

Return

4.2 Insert Host(Alias) to PAD alias

4.2.1 Method

4.2.2 cURL (example)

© 2019 Toffs Technologies Pte Ltd


Commercial-In-Confidential
Version 1.0
June 2019

Successful output returned

4.3 Delete Host(Alias) from PAD alias

4.3.1 Method

4.3.2 cURL (Example)

Successful output returned

PURGE CACHE
5.1 Purge by pad

5.1.1 Method

5.1.2 Required parameters

© 2019 Toffs Technologies Pte Ltd


Commercial-In-Confidential
Version 1.0
June 2019

5.1.3 cURL (Example)

Successful output returned

5.2 Purge by Url

5.2.1 Method

5.2.2 Required parameters

E.g.:

5.2.3 cURL (example)

© 2019 Toffs Technologies Pte Ltd


Commercial-In-Confidential
Version 1.0
June 2019

Successful output returned

5.3 Purge by Brand

5.3.1 Method

5.3.2 Required parameters

5.3.3 cURL (example)

Successful output returned

© 2019 Toffs Technologies Pte Ltd


Commercial-In-Confidential
Version 1.0
June 2019

5.4 Purge by Account

5.4.1 Method

5.4.2 Required parameters

5.4.3 cURL (example)

Successful output returned

© 2019 Toffs Technologies Pte Ltd


Commercial-In-Confidential
Version 1.0
June 2019

5.5 Purge Cache Status

5.5.1 Method

5.5.2 Required parameters

5.5.3 cURL (example)

Successful output returned

© 2019 Toffs Technologies Pte Ltd


Commercial-In-Confidential
Version 1.0
June 2019

GET USER INFO


6.1 Method

6.1.2 cURL (example)

Successful output returned

GET ACCOUNT LIST


7.1 Method

7.1.2 cURL (example)

© 2019 Toffs Technologies Pte Ltd


Commercial-In-Confidential
Version 1.0
June 2019

Successful output returned

7.2 Get Brand List By Account

7.2.1 Method

7.2.3 Required parameters

7.3.3 Optional Parameters

© 2019 Toffs Technologies Pte Ltd


Commercial-In-Confidential
Version 1.0
June 2019

PAGE RULES

8.1 Get Page Rules List

8.1.1 Method

8.1.2 Required Parameters

8.1.3 Optional Parameters

code redirect forwarding location_w_rules rewrite_url rewrite_header rewrite_cookie


proxy_set_header

8.1.4 cURL (example)

curl -X GET \

https://api.toffstech.com/v1/pagerules?pad_id=5978 \

-H 'X-Auth-Email: t2api@toffstech.com' \

-H 'X-Auth-Token: 0284af49b1fd267248a7684f8b58e92a

© 2019 Toffs Technologies Pte Ltd


Commercial-In-Confidential
Version 1.0
June 2019

Response (example)

"errors": [],

"message": [],

"result": [

"id": 131,

"pad_id": 5976,

"name": "api_pagerules_name_2",

"code": "redirect",

"data": "{\"status_code\":301,\"from\":\"https://www.aaa.com\",\"to\":\"https://www.bbb.com\"}"

},

"id": 130,

"pad_id": 5976,

"name": "api_pagerules_name_1",

"code": "redirect",

"data": "{\"status_code\":301,\"from\":\"https://www.aaa.com\",\"to\":\"https://www.bbb.com\"}"

],

"success": true

8.2 Get Page Rule

8.2.1 Method

GET pagerule/:pagerule_id

© 2019 Toffs Technologies Pte Ltd


Commercial-In-Confidential
Version 1.0
June 2019

8.2.1 cURL (Example)

curl -X GET \

https://api.toffstech.com/v1/pagerule/131 \

-H 'X-Auth-Email: t2api@toffstech.com' \

-H 'X-Auth-Token: 0284af49b1fd267248a7684f8b58e92a'

Response Example

"errors": [],

"message": [],

"result": {

"id": 131,

"pad_id": 5976,

"name": "api_pagerules_name_update",

"code": "redirect",

"data": "{\"status_code\":301,\"from\":\"https://www.ccc.com\",\"to\":\"https://www.ddd.com\"}"

},

"success": true

8.3 Create new Page Rule

8.3.1 Method

POST pagerule

© 2019 Toffs Technologies Pte Ltd


Commercial-In-Confidential
Version 1.0
June 2019

8.3.2 Required Parameters

pad_id

name

code

data

The data is JSON data, the specific format is determined by the code

8.3.3 Code Range:

a. Redirect
Dataformat
{"status_code":301,"from":"https://www.aaa.com","to":"https://www.bbb.com"}

b. Forwarding
Data Format:
{"status_code":303,"from":"/xx","to":"https://www.aaa.com"}

c. location_w_rules
Data format:
{"location":"/zh-cn/
","ignore_origin_cache_control":false,"cache_level":1,"edge_cache_ttl":
1800,"browser_cache_ttl":0}

d. Rewrite_url
Data format:
{"from":"/aa-web/xx.do","to":"/bb-web/xx"}

e. Rewrite_header
Data format:
{"header_name":"name_1","value":"value_1"}

f. Rewrite_cookie
Data format:
{"cookie_name":"name_2","value":"value_2"}

g. Proxy_set_header
Data format:
{"header_name":"proxy_set_header","value":"X-Real-IP $remote_addr"}

© 2019 Toffs Technologies Pte Ltd


Commercial-In-Confidential
Version 1.0
June 2019

8.3.4 cURL (Example)

curl -X POST \

https://api.toffstech.com/v1/pagerule \

-H 'X-Auth-Email: t2api@toffstech.com' \

-H 'X-Auth-Token: 0284af49b1fd267248a7684f8b58e92a' \

-F pad_id=5976 \

-F name=api_pagerules_name \

-F code=redirect \

-F 'data={"status_code":301,"from":"https://www.aaa.com","to":"https://www.bbb.com"}'

Successful Output Returned

"errors": [],

"message": [],

"result": {

"id": 59,

"pad_id": 5976,

"name": "api_pagerules_name",

"code": "redirect",

"data": "{\"status_code\":301,\"from\":\"https://www.aaa.com\",\"to\":\"https://www.bbb.com\"}"

},

"success": true

8.4 Update Page Rule

8.4.1 Method

PUT pagerule/<pagerule_id>

© 2019 Toffs Technologies Pte Ltd


Commercial-In-Confidential
Version 1.0
June 2019

8.4.2 Required parameters

name

code

data

* The data is JSON data, the specific format is determined by the code

8.4.3 Code Range:

a. Redirect
Dataformat:
{"status_code":301,"from":"https://www.aaa.com","to":"https://www.bbb.com"}

b. Forwarding
Data format:
{"status_code":303,"from":"/xx","to":"https://www.aaa.com"}

c. Location_w_rules
Dataformat:
{"location":"/zh-cn/
","ignore_origin_cache_control":false,"cache_level":1,"edge_cache_ttl":
1800,"browser_cache_ttl":0}

d. Rewrite_url
Data format:
{"from":"/aa-web/xx.do","to":"/bb-web/xx"}

e. Rewrite_header
Data format:
{"header_name":"name_1","value":"value_1"}

f. Rewrite_cookie
Data format:
{"cookie_name":"name_2","value":"value_2"}

g. Proxy_set_header
Data format:
{"header_name":"proxy_set_header","value":"X-Real-IP $remote_addr"}

© 2019 Toffs Technologies Pte Ltd


Commercial-In-Confidential
Version 1.0
June 2019

curl -X PUT \

https://api.toffstech.com/v1/pagerule/131 \

-H 'X-Auth-Email: t2api@toffstech.com' \

-H 'X-Auth-Token: 0284af49b1fd267248a7684f8b58e92a' \

-F name=api_pagerules_name_update \

-F code=redirect \

-F 'data={"status_code":301,"from":"https://www.ccc.com","to":"https://www.ddd.com"}

Successful output returned

"errors": [],

"message": [],

"result": {

"id": 131,

"pad_id": 5976,

"name": "api_pagerules_name_update",

"code": "redirect",

"data": "{\"status_code\":301,\"from\":\"https://www.ccc.com\",\"to\":\"https://www.ddd.com\"}"

},

"success": true

8.5 Delete Page Rule

8.5.1 Method

DELETE pagerule/:pagerule_id

© 2019 Toffs Technologies Pte Ltd


Commercial-In-Confidential
Version 1.0
June 2019

8.5.2 cURL (Example)

curl -X DELETE \

https://api.toffstech.com/v1/pagerule/131 \

-H 'X-Auth-Email: t2api@toffstech.com' \

-H 'X-Auth-Token: 0284af49b1fd267248a7684f8b58e92a'

Successful output returned

"errors": [],

"message": [],

"result":

{ "status":

true

},

"success": true

TOFFS IP List

9.1 Get TOFFS IP list

9.1.1 Method

9.1.2 Required parameters

© 2019 Toffs Technologies Pte Ltd


Commercial-In-Confidential
Version 1.0
June 2019

9.1.3 cURL (Example)

Response

© 2019 Toffs Technologies Pte Ltd


Commercial-In-Confidential

You might also like