This repository was archived by the owner on Sep 17, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Dynamic Local Request Workflow
LoLo edited this page May 2, 2017
·
4 revisions
To do IP Gateway connection or IAAA verification dynamically, we create a interactive pattern named request instruction. A typical workflow is something like below.
Firstly, get request instruction from our server.
GET services/ipgw/get_request
- (required) command: (i.e. connect|disconnect|disconnect_all|get_connections|disconnect_ip)
- (optional) step: ()
sample response payload: (connect)
{
"url": "https://example.com/foo",
"method": "post",
"headers":
{
"Accept": "text/html",
"User-Agent": "IPGWiOS1.2_"
},
"parameters":
{
"app": "IPGWiOS1.2",
"cmd": "open",
"iprange": "free",
"username": "{user_id}",
"password": "{password}"
}
}
Some of the value might need to be set locally using replacement blocks. A replacement block is an alphanumeric string surrounded by {
and }
. It could be parameter value or even a part of the url.
Make request based on the request instruction locally (on Android/iOS/PC/Browser client). Then pass the response back to the server:
POST services/ipgw/parse_response
- (required) command: (i.e. connect|disconnect|disconnect_all|get_connections|disconnect_ip)
- (required) status_code: (the HTTP status code of response)
- (required) body: (the content of response body)
- (optional) step: ()
sample response payload: (get_connections)
{
"next_step": null,
"response":
{
"connections":
[
{
"ip": "162.105.75.223",
"position": "电子学系及周边",
"connected_at": "2017-04-15 16:02:53 // (perhaps timestamp is better)"
},
{
"ip": "10.2.212.212",
"position": "45甲4-6层",
"connected_at": "2017-04-15 17:54:01 // (perhaps timestamp is better)"
}
]
}
}
Or additional steps are required:
{
"next_step": "name_of_next_step",
"response": null
}
Sometimes there are some extra parameters: (i.e. login)
{
"next_step": "name_of_next_step",
"response":
{
"iaaa_token": "the token of portal IAAA"
}
}