Search
From ToxBank API Wiki
(Difference between revisions)
m (→Create a predefined query) |
m (→Alerts) |
||
Line 71: | Line 71: | ||
= Alerts = | = Alerts = | ||
− | + | An alert is defined by query URI and a frequency. | |
− | + | ||
+ | === [http://www.w3.org/DesignIssues/Notation3 N3] representation of an alert === | ||
+ | <http://toxbank.net/services/alerts/Alert_33> | ||
+ | a tb:Alert ; | ||
+ | dc:title "My first alert"; | ||
+ | tb:hasQuery <http://toxbank.net/services/query/Q456>; | ||
+ | tb:frequency tb:Daily; | ||
+ | tb:userToBeNotified <http://toxbank.net/services/user/U8247634857324857>. | ||
+ | |||
+ | == Retrieve alerts == | ||
+ | |||
+ | {{REST Operations | ||
+ | |REST_op_description=Retrieve alerts | ||
+ | |REST_op_method=GET | ||
+ | |REST_op_uri=/user/{obfuscatedid}/alerts | ||
+ | |REST_op_params=TBD, search paratemers to filter alerts | ||
+ | |REST_header_param=subjectid:SECURITY-TOKEN | ||
+ | |REST_op_mime_input= | ||
+ | |REST_op_result=content in supported formats | ||
+ | |REST_op_mime_output=text/uri-list, RDF, JSON | ||
+ | |REST_op_status=200,202,400,401,402,403 | ||
+ | }} | ||
+ | |||
+ | === cURL example === | ||
+ | $curl -X GET http://toxbank.net/services/alerts -H "Accept:text/n3" | ||
+ | .... | ||
+ | <http://toxbank.net/services/alerts/Alert_33> | ||
+ | a tb:Alert ; | ||
+ | dc:title "My first alert"; | ||
+ | tb:hasQuery <http://toxbank.net/services/query/Q456>; | ||
+ | tb:frequency tb:Daily; | ||
+ | tb:userToBeNotified <http://toxbank.net/services/user/U8247634857324857>. | ||
+ | <http://toxbank.net/services/alerts/Alert_34> | ||
+ | a tb:Alert ; | ||
+ | dc:title "My second alert"; | ||
+ | tb:hasQuery <http://toxbank.net/services/query/Q789>; | ||
+ | tb:frequency tb:Weekly; | ||
+ | tb:userToBeNotified <http://toxbank.net/services/user/U8247634857324857>. | ||
+ | |||
+ | == Create an alert == | ||
+ | |||
+ | {{REST Operations | ||
+ | |REST_op_description=Creates an alert | ||
+ | |REST_op_method=POST | ||
+ | |REST_op_uri=/user/{obfuscatedid}/alerts | ||
+ | |REST_op_params=query uri, frequency (predefined list),name | ||
+ | |REST_header_param=subjectid:SECURITY-TOKEN | ||
+ | |REST_op_mime_input=application/x-www-form-urlencoded, RDF, JSON | ||
+ | |REST_op_result=Task URI, when complete - URI of the new alert , e.g. /user/U8247634857324857/alerts/Alert_5678 | ||
+ | |REST_op_mime_output=text/uri-list | ||
+ | |REST_op_status=200,202,400,401,402,403 | ||
+ | }} | ||
+ | |||
+ | === cURL example === | ||
+ | $curl -X POST http://toxbank.net/services/alerts -d "query=http://toxbank.net/services/query/Q789" -d "frequency=Weekly" | ||
+ | >HTTP/1.1 200 OK | ||
+ | >http://toxbank.net/services/alerts/Alert_34 | ||
+ | |||
+ | == Retrieve an Alert == | ||
+ | |||
+ | {{REST Operations | ||
+ | |REST_op_description=Retrieve an alert | ||
+ | |REST_op_method=GET | ||
+ | |REST_op_uri=/user/{obfuscatedid}/alerts/{id} | ||
+ | |REST_op_params= | ||
+ | |REST_header_param=subjectid:SECURITY-TOKEN | ||
+ | |REST_op_mime_input= | ||
+ | |REST_op_result=content in supported formats | ||
+ | |REST_op_mime_output=text/uri-list, RDF, JSON | ||
+ | |REST_op_status=200,202,400,401,402,403 | ||
+ | }} | ||
+ | |||
+ | == Update an Alert == | ||
+ | |||
+ | {{REST Operations | ||
+ | |REST_op_description=Update an alert | ||
+ | |REST_op_method=PUT | ||
+ | |REST_op_uri=/user/{obfuscatedid}/alerts/{id} | ||
+ | |REST_op_params= | ||
+ | |REST_header_param=subjectid:SECURITY-TOKEN | ||
+ | |REST_op_mime_input=application/x-www-form-urlencoded, RDF, JSON | ||
+ | |REST_op_result=Task uri, including error reports | ||
+ | |REST_op_mime_output=text/uri-list | ||
+ | |REST_op_status=200,202,400,401,402,403 | ||
+ | }} | ||
+ | |||
+ | == Delete an Alert == | ||
+ | |||
+ | {{REST Operations | ||
+ | |REST_op_description=Deletes an alert | ||
+ | |REST_op_method=DELETE | ||
+ | |REST_op_uri=/user/{obfuscatedid}/alerts/{id} | ||
+ | |REST_op_params=nons | ||
+ | |REST_header_param=subjectid:SECURITY-TOKEN | ||
+ | |REST_op_mime_input=none | ||
+ | |REST_op_result= | ||
+ | |REST_op_mime_output=text/uri-list | ||
+ | |REST_op_status=200,202,400,401,402,403 | ||
+ | }} |
Revision as of 07:34, 16 September 2011
Contents |
Search
Description | Search in the default space |
---|---|
Resource | [[]] |
Method | GET |
URI | /query |
Parameters | TBD, search parameters, page parameters |
Header Parameters | subjectid:SECURITY-TOKEN |
Media Type (input) | application/x-www-form-urlencoded, RDF, JSON |
Results | URIs of the results, or in other supported format |
Media Type (output) | text/uri-list, RDF, JSON |
Status code | 200,400,401,402,403 |
Search Protocols
Description | Search protocols |
---|---|
Resource | [[]] |
Method | GET |
URI | /query/protocols |
Parameters | TBD, search parameters, page parameters |
Header Parameters | subjectid:SECURITY-TOKEN |
Media Type (input) | application/x-www-form-urlencoded, RDF, JSON |
Results | URIs of the protocols found, or in other supported format |
Media Type (output) | text/uri-list, RDF, JSON |
Status code | 200,400,401,402,403 |
Search Studies
Description | Search studies |
---|---|
Resource | [[]] |
Method | GET |
URI | /query/study |
Parameters | TBD, search parameters, page parameters |
Header Parameters | subjectid:SECURITY-TOKEN |
Media Type (input) | application/x-www-form-urlencoded, RDF, JSON |
Results | URIs of the studies found, or in other supported format |
Media Type (output) | text/uri-list, RDF, JSON |
Status code | 200,400,401,402,403 |
Search Data
Description | Search data |
---|---|
Resource | [[]] |
Method | GET |
URI | /query/data |
Parameters | TBD, search parameters, page parameters |
Header Parameters | subjectid:SECURITY-TOKEN |
Media Type (input) | application/x-www-form-urlencoded, RDF, JSON |
Results | URIs of the datasets found, or in other supported format |
Media Type (output) | text/uri-list, RDF, JSON |
Status code | 200,400,401,402,403 |
Create a predefined query
Description | Create a predefined query |
---|---|
Resource | [[]] |
Method | POST |
URI | /query |
Parameters | TBD |
Header Parameters | subjectid:SECURITY-TOKEN |
Media Type (input) | application/x-www-form-urlencoded, RDF, JSON |
Results | URI of the new query, e.g. /query/Q999 |
Media Type (output) | text/uri-list |
Status code | 200,400,401,402,403 |
Alerts
An alert is defined by query URI and a frequency.
N3 representation of an alert
<http://toxbank.net/services/alerts/Alert_33> a tb:Alert ; dc:title "My first alert"; tb:hasQuery <http://toxbank.net/services/query/Q456>; tb:frequency tb:Daily; tb:userToBeNotified <http://toxbank.net/services/user/U8247634857324857>.
Retrieve alerts
Description | Retrieve alerts |
---|---|
Resource | [[]] |
Method | GET |
URI | /user/{obfuscatedid}/alerts |
Parameters | TBD, search paratemers to filter alerts |
Header Parameters | subjectid:SECURITY-TOKEN |
Media Type (input) | |
Results | content in supported formats |
Media Type (output) | text/uri-list, RDF, JSON |
Status code | 200,202,400,401,402,403 |
cURL example
$curl -X GET http://toxbank.net/services/alerts -H "Accept:text/n3" .... <http://toxbank.net/services/alerts/Alert_33> a tb:Alert ; dc:title "My first alert"; tb:hasQuery <http://toxbank.net/services/query/Q456>; tb:frequency tb:Daily; tb:userToBeNotified <http://toxbank.net/services/user/U8247634857324857>. <http://toxbank.net/services/alerts/Alert_34> a tb:Alert ; dc:title "My second alert"; tb:hasQuery <http://toxbank.net/services/query/Q789>; tb:frequency tb:Weekly; tb:userToBeNotified <http://toxbank.net/services/user/U8247634857324857>.
Create an alert
Description | Creates an alert |
---|---|
Resource | [[]] |
Method | POST |
URI | /user/{obfuscatedid}/alerts |
Parameters | query uri, frequency (predefined list),name |
Header Parameters | subjectid:SECURITY-TOKEN |
Media Type (input) | application/x-www-form-urlencoded, RDF, JSON |
Results | Task URI, when complete - URI of the new alert , e.g. /user/U8247634857324857/alerts/Alert_5678 |
Media Type (output) | text/uri-list |
Status code | 200,202,400,401,402,403 |
cURL example
$curl -X POST http://toxbank.net/services/alerts -d "query=http://toxbank.net/services/query/Q789" -d "frequency=Weekly" >HTTP/1.1 200 OK >http://toxbank.net/services/alerts/Alert_34
Retrieve an Alert
Description | Retrieve an alert |
---|---|
Resource | [[]] |
Method | GET |
URI | /user/{obfuscatedid}/alerts/{id} |
Parameters | |
Header Parameters | subjectid:SECURITY-TOKEN |
Media Type (input) | |
Results | content in supported formats |
Media Type (output) | text/uri-list, RDF, JSON |
Status code | 200,202,400,401,402,403 |
Update an Alert
Description | Update an alert |
---|---|
Resource | [[]] |
Method | PUT |
URI | /user/{obfuscatedid}/alerts/{id} |
Parameters | |
Header Parameters | subjectid:SECURITY-TOKEN |
Media Type (input) | application/x-www-form-urlencoded, RDF, JSON |
Results | Task uri, including error reports |
Media Type (output) | text/uri-list |
Status code | 200,202,400,401,402,403 |
Delete an Alert
Description | Deletes an alert |
---|---|
Resource | [[]] |
Method | DELETE |
URI | /user/{obfuscatedid}/alerts/{id} |
Parameters | nons |
Header Parameters | subjectid:SECURITY-TOKEN |
Media Type (input) | none |
Results | |
Media Type (output) | text/uri-list |
Status code | 200,202,400,401,402,403 |
Facts about SearchRDF feed
Acts on | |
Has output media type | text/uri-list, RDF, JSON + and text/uri-list + |
Has status code | 200,400,401,402,403 + and 200,202,400,401,402,403 + |