Endpoints (Version 1.1)
← Older revision
Revision as of 09:52, 30 December 2013
(2 intermediate revisions by one user not shown)
Line 2:
Line 2:
= Middleware API =
= Middleware API =
−
+
==
Endpoints
(
Version
1.1
)
==
−
+
−
==
Suggested Process Flow ==
+
−
=== User Registration ===
+
−
* A user signs up with an email address and a password
+
−
** Receives a private key ''
(
used for signing requests to the API)''
+
−
* Account is in pending stage
+
−
* ORG confirms account
+
−
* User receives email address notifying they can activate probes
+
−
+
−
[[File:User_Signup_Process.jpg]]
+
−
+
−
=== Probe Registration ===
+
−
* A user hits /prepare/probe to receive a one key used to seed the probe UUID
+
−
** Each call generates a new seed
+
−
* The probe generates a UUID
+
−
** A combination of the seed and something unique to the device ''(e.g. MAC address)''
+
−
* The user POSTs relevant info to /register/probe signed with the users private key
+
−
** Receives back a private key which is for use by the probe for probe related activities e.g. updating GCM info, requesting tests or submitting results
+
−
* The probe information is recorded against the user
+
−
+
−
[[File:Probe_Registration.jpg|900px]]
+
−
+
−
=== URL Submission ===
+
−
* User on Blocked.org / a probe with a UI submits a URL
+
−
** DB checked for duplication
+
−
*** If duplicated possibly reschedule on assumption user is inquisitive and URL may have been blocked/unblocked since last checks
+
−
*** Or Reject
+
−
** URL inserted with status of "pending"
+
−
** Return submission status to user
+
−
* Minutely cron kicks off to find all URLs that are pending
+
−
** Check URL is resolveable
+
−
** HEAD / GET URL
+
−
*** Confirm headers / content length etc match
+
−
** Update row with status of ready and headers / return code etc
+
−
+
−
+
−
==
1.1
Endpoints
==
+
Root endpoint ''e.g. https://api.blocked.org/version/.....''
Root endpoint ''e.g. https://api.blocked.org/version/.....''
<!-- POST /register/user -->
<!-- POST /register/user -->
−
=== POST /register/user <span style="color:DarkGreen;font-weight:bold;">
-
Implemented</span>
===
+
=== POST /register/user
===
+
<span style="color:DarkGreen;font-weight:bold;">
'''
Implemented
'''
</span>
For registering a user account.
For registering a user account.
Line 68:
Line 32:
<code>{"status":"pending","success":true,"private_key":"----BEGIN PRIVATE KEY....."}</code>
<code>{"status":"pending","success":true,"private_key":"----BEGIN PRIVATE KEY....."}</code>
−
=== POST /status/user <span style="color:DarkGreen;font-weight:bold;">
-
Implemented</span>
===
+
=== POST /status/user
===
+
<span style="color:DarkGreen;font-weight:bold;">
'''
Implemented
'''
</span>
+
For checking on your registration status
For checking on your registration status
Line 91:
Line 57:
<code>{"success":true, "status":"pending|failed|ok"}</code>
<code>{"success":true, "status":"pending|failed|ok"}</code>
−
=== POST /prepare/probe <span style="color:DarkGreen;font-weight:bold;">
-
Implemented</span>
===
+
=== POST /prepare/probe
===
+
<span style="color:DarkGreen;font-weight:bold;">
'''
Implemented
'''
</span>
+
For preparing to register a probe
For preparing to register a probe
Line 115:
Line 83:
<code>{"success":true,"probe_hmac":"abc1234"}</code>
<code>{"success":true,"probe_hmac":"abc1234"}</code>
−
=== POST /register/probe <span style="color:DarkGreen;font-weight:bold;">
-
Implemented</span>
===
+
=== POST /register/probe
===
+
<span style="color:DarkGreen;font-weight:bold;">
'''
Implemented
'''
</span>
+
For registering a probe. The probe UUID is constructed via the follow pseudo code.
For registering a probe. The probe UUID is constructed via the follow pseudo code.
Line 160:
Line 130:
<code>{"success":true,"private_key":"-----BEGIN RSA PRIVATE KEY-----"}</code>
<code>{"success":true,"private_key":"-----BEGIN RSA PRIVATE KEY-----"}</code>
−
=== POST /update/gcm <span style="color:DarkGreen;font-weight:bold;">
-
Implemented</span>
===
+
=== POST /update/gcm
===
+
<span style="color:DarkGreen;font-weight:bold;">
'''
Implemented
'''
</span>
+
For updating GCM regid meta information
For updating GCM regid meta information
Line 187:
Line 159:
−
=== POST /submit/url <span style="color:DarkGreen;font-weight:bold;">
-
Implemented</span>
===
+
=== POST /submit/url
===
+
<span style="color:DarkGreen;font-weight:bold;">
'''
Implemented
'''
</span>
+
To add a new URL to the database for testing
To add a new URL to the database for testing
Line 224:
Line 198:
<!-- GET /request/httpt -->
<!-- GET /request/httpt -->
−
=== GET /request/httpt
<span style="color:DarkGreen;font-weight:bold;">- Implemented</span>
===
+
=== GET /request/httpt ===
To get a HTTP test payload.
To get a HTTP test payload.
Line 244:
Line 218:
<code>{"success":true,"url":http://test.com"}</code>
<code>{"success":true,"url":http://test.com"}</code>
−
==
Backend
==
+
==
Endpoints (Version 1.2)
==
[[Category:Censorship Monitoring Project]]
[[Category:Censorship Monitoring Project]]