Alert

From ToxBank API Wiki
(Difference between revisions)
Jump to: navigation, search
(Delete an Alert)
(cURL example)
 
(11 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 +
{{REST_resource}}
 +
 
= Alerts =
 
= Alerts =
  
Line 14: Line 16:
  
 
== Retrieve alerts ==
 
== Retrieve alerts ==
 
+
{{HasOperation |id=API_Alert_RetrieveList}}
{{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 example ===
  $curl -X GET http://toxbank.net/services/alerts -H "Accept:text/n3"
+
  $curl -X GET http://toxbanktest1.opentox.org:8080/toxbank/user/U2/alert/A105 -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 ==
+
<pre>
 +
@prefix tb: <http://onto.toxbank.net/api/> .
 +
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
 +
@prefix ncal: <http://www.semanticdesktop.org/ontologies/ncal/> .
 +
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
 +
@prefix tba: <http://toxbanktest1.opentox.org:8080/toxbank/alert/> .
 +
@prefix tbu: <http://toxbanktest1.opentox.org:8080/toxbank/user/> .
 +
@prefix dcterms: <http://purl.org/dc/terms/> .
  
{{REST Operations
+
tbu:U2
|REST_op_description=Creates an alert
+
a ncal:Attendee , tb:User .
|REST_op_method=POST
+
 
|REST_op_uri=/user/{obfuscatedid}/alerts
+
<http://toxbanktest1.opentox.org:8080/toxbank/user/U2/alert/A105>
|REST_op_params=query uri, frequency (predefined list),name
+
a ncal:Event ;
|REST_header_param=subjectid:SECURITY-TOKEN
+
dcterms:subject "?keyword=http%3A%2F%2Fwww.owl-ontologies.com%2Ftoxbank.owl%2FK259&keyword=http%3A%2F%2Fwww.owl-ontologies.com%2Ftoxbank.owl%2FK206&keyword=http%3A%2F%2Fwww.owl-ontologies.com%2Ftoxbank.owl%2FK230&metadata=carbachol&resourceType=investigation&resourceType=protocol" ;
|REST_op_mime_input=application/x-www-form-urlencoded, RDF,  JSON
+
dcterms:title "carbachol" ;
|REST_op_result=Task URI, when complete - URI of the new alert , e.g. /user/U8247634857324857/alerts/Alert_5678
+
ncal:attendee tbu:U2 ;
|REST_op_mime_output=text/uri-list
+
ncal:categories "FREETEXT" ;
|REST_op_status=200,202,400,401,402,403
+
ncal:rrule
}}
+
[ a ncal:RecurrenceRule ;
 +
ncal:freq ncal:hourly ;
 +
ncal:interval "1"^^xsd:int
 +
] .
 +
 
 +
ncal:hourly
 +
a ncal:RecurrenceFrequency .
 +
</pre>
 +
 
 +
== Create an alert ==
 +
{{HasOperation |id=API_Alert_Create}}
  
 
=== cURL example ===
 
=== cURL example ===
Line 63: Line 58:
  
 
== Retrieve an Alert ==
 
== Retrieve an Alert ==
 
+
{{HasOperation |id=API_Alert_Retrieve}}
{{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 ==
 
== Update an Alert ==
 
+
{{HasOperation |id=API_Alert_Update}}
{{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 ==
 
== Delete an Alert ==
{{HasOperation |id=API_Alert:DeleteAlert}}
+
{{HasOperation |id=API_Alert_DeleteAlert}}
 +
 
 +
=RDF representation=
 +
[http://jenkins.toxbank.net/job/toxbank-api-beans/ws/target/test-classes/net.toxbank.client.resource.Alert.40.n3/*view*/ RDF N3]
 +
 
 +
 
 +
== Stable version ==
 +
[http://jenkins.toxbank.net/job/production-toxbank-api-beans/ws/target/test-classes/net.toxbank.client.resource.Alert.44.n3 RDF N3]
 +
 
 +
This RDF representation is automatically generated by the production version of the [https://github.com/ToxBank/toxbank-api-beans/tree/toxbank-api-beans-0.0.2 Toxbank Java client library]
 +
 
 +
== Alpha test version ==
 +
[http://jenkins.toxbank.net/job/alpha-toxbank-api-beans/ws/target/test-classes/net.toxbank.client.resource.Alert.44.n3 RDF/N3]
 +
 
 +
This RDF representation is automatically generated by the alpha test version of the [https://github.com/ToxBank/toxbank-api-beans/tree/alphatest Toxbank Java client library]
 +
 
 +
== Development version ==
 +
[http://jenkins.toxbank.net/job/dev-toxbank-api-beans/ws/target/test-classes/net.toxbank.client.resource.Alert.44.n3 RDF/N3]
 +
 
 +
This RDF representation is automatically generated by the latest version of the [https://github.com/ToxBank/toxbank-api-beans Toxbank Java client library]
 +
 
 +
== Example in RDF/XML format ==
 +
 
 +
<pre>
 +
<?xml version="1.0"?>
 +
<!DOCTYPE rdf:RDF [
 +
  <!ENTITY tb 'http://onto.toxbank.net/api/'>
 +
  <!ENTITY foaf 'http://xmlns.com/foaf/0.1/'>
 +
  <!ENTITY ncal 'http://www.semanticdesktop.org/ontologies/ncal/'>
 +
  <!ENTITY xsd 'http://www.w3.org/2001/XMLSchema#'>
 +
  <!ENTITY rdf 'http://www.w3.org/1999/02/22-rdf-syntax-ns#'>
 +
  <!ENTITY tba 'http://toxbanktest1.opentox.org:8080/toxbank/alert/'>
 +
  <!ENTITY tbu 'http://toxbanktest1.opentox.org:8080/toxbank/user/'>
 +
  <!ENTITY dcterms 'http://purl.org/dc/terms/'>]>
 +
<rdf:RDF
 +
    xmlns:tba="&tba;"
 +
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
 +
    xmlns:foaf="&foaf;"
 +
    xmlns:tbu="&tbu;"
 +
    xmlns:dcterms="&dcterms;"
 +
    xmlns:xsd="&xsd;"
 +
    xmlns:ncal="&ncal;"
 +
    xmlns:tb="&tb;">
 +
  <ncal:Event rdf:about="http://toxbanktest1.opentox.org:8080/toxbank/user/U2/alert/A105">
 +
    <ncal:attendee>
 +
      <tb:User rdf:about="&tbu;U2">
 +
        <rdf:type rdf:resource="&ncal;Attendee"/>
 +
      </tb:User>
 +
    </ncal:attendee>
 +
    <ncal:rrule>
 +
      <ncal:RecurrenceRule>
 +
        <ncal:interval rdf:datatype="&xsd;int">1</ncal:interval>
 +
        <ncal:freq>
 +
          <ncal:RecurrenceFrequency rdf:about="&ncal;hourly"/>
 +
        </ncal:freq>
 +
      </ncal:RecurrenceRule>
 +
    </ncal:rrule>
 +
    <dcterms:subject>?keyword=http%3A%2F%2Fwww.owl-ontologies.com%2Ftoxbank.owl%2FK259&amp;keyword=http%3A%2F%2Fwww.owl-ontologies.com%2Ftoxbank.owl%2FK249&amp;keyword=http%3A%2F%2Fwww.owl-ontologies.com%2Ftoxbank.owl%2FK230&amp;metadata=carbachol&amp;resourceType=investigation&amp;resourceType=protocol</dcterms:subject>
 +
    <ncal:categories>FREETEXT</ncal:categories>
 +
    <dcterms:title>carbachol</dcterms:title>
 +
  </ncal:Event>
 +
</rdf:RDF>
 +
 
 +
</pre>

Latest revision as of 14:23, 4 December 2012

Alert


Contents

Alerts

An Alert is defined by Query URI ,frequency and an User to be notified.

(could be also groups instead of users?)

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 Alert
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

Links: Page, Edit with form



cURL example

$curl -X GET http://toxbanktest1.opentox.org:8080/toxbank/user/U2/alert/A105 -H "Accept:text/n3" 
@prefix tb: <http://onto.toxbank.net/api/> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix ncal: <http://www.semanticdesktop.org/ontologies/ncal/> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix tba: <http://toxbanktest1.opentox.org:8080/toxbank/alert/> .
@prefix tbu: <http://toxbanktest1.opentox.org:8080/toxbank/user/> .
@prefix dcterms: <http://purl.org/dc/terms/> .

tbu:U2
a ncal:Attendee , tb:User .

<http://toxbanktest1.opentox.org:8080/toxbank/user/U2/alert/A105>
a ncal:Event ;
dcterms:subject "?keyword=http%3A%2F%2Fwww.owl-ontologies.com%2Ftoxbank.owl%2FK259&keyword=http%3A%2F%2Fwww.owl-ontologies.com%2Ftoxbank.owl%2FK206&keyword=http%3A%2F%2Fwww.owl-ontologies.com%2Ftoxbank.owl%2FK230&metadata=carbachol&resourceType=investigation&resourceType=protocol" ;
dcterms:title "carbachol" ;
ncal:attendee tbu:U2 ;
ncal:categories "FREETEXT" ;
ncal:rrule
[ a ncal:RecurrenceRule ;
ncal:freq ncal:hourly ;
ncal:interval "1"^^xsd:int
] .

ncal:hourly
a ncal:RecurrenceFrequency .

Create an alert

Description Creates an alert
Resource Alert
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

Links: Page, Edit with form



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 Alert
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

Links: Page, Edit with form



Update an Alert

Description Update an alert
Resource Alert
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

Links: Page, Edit with form



Delete an Alert

Description Deletes an alert
Resource Alert
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

Links: Page, Edit with form



RDF representation

RDF N3


Stable version

RDF N3

This RDF representation is automatically generated by the production version of the Toxbank Java client library

Alpha test version

RDF/N3

This RDF representation is automatically generated by the alpha test version of the Toxbank Java client library

Development version

RDF/N3

This RDF representation is automatically generated by the latest version of the Toxbank Java client library

Example in RDF/XML format

<?xml version="1.0"?>
<!DOCTYPE rdf:RDF [
  <!ENTITY tb 'http://onto.toxbank.net/api/'>
  <!ENTITY foaf 'http://xmlns.com/foaf/0.1/'>
  <!ENTITY ncal 'http://www.semanticdesktop.org/ontologies/ncal/'>
  <!ENTITY xsd 'http://www.w3.org/2001/XMLSchema#'>
  <!ENTITY rdf 'http://www.w3.org/1999/02/22-rdf-syntax-ns#'>
  <!ENTITY tba 'http://toxbanktest1.opentox.org:8080/toxbank/alert/'>
  <!ENTITY tbu 'http://toxbanktest1.opentox.org:8080/toxbank/user/'>
  <!ENTITY dcterms 'http://purl.org/dc/terms/'>]>
<rdf:RDF
    xmlns:tba="&tba;"
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:foaf="&foaf;"
    xmlns:tbu="&tbu;"
    xmlns:dcterms="&dcterms;"
    xmlns:xsd="&xsd;"
    xmlns:ncal="&ncal;"
    xmlns:tb="&tb;">
  <ncal:Event rdf:about="http://toxbanktest1.opentox.org:8080/toxbank/user/U2/alert/A105">
    <ncal:attendee>
      <tb:User rdf:about="&tbu;U2">
        <rdf:type rdf:resource="&ncal;Attendee"/>
      </tb:User>
    </ncal:attendee>
    <ncal:rrule>
      <ncal:RecurrenceRule>
        <ncal:interval rdf:datatype="&xsd;int">1</ncal:interval>
        <ncal:freq>
          <ncal:RecurrenceFrequency rdf:about="&ncal;hourly"/>
        </ncal:freq>
      </ncal:RecurrenceRule>
    </ncal:rrule>
    <dcterms:subject>?keyword=http%3A%2F%2Fwww.owl-ontologies.com%2Ftoxbank.owl%2FK259&keyword=http%3A%2F%2Fwww.owl-ontologies.com%2Ftoxbank.owl%2FK249&keyword=http%3A%2F%2Fwww.owl-ontologies.com%2Ftoxbank.owl%2FK230&metadata=carbachol&resourceType=investigation&resourceType=protocol</dcterms:subject>
    <ncal:categories>FREETEXT</ncal:categories>
    <dcterms:title>carbachol</dcterms:title>
  </ncal:Event>
</rdf:RDF>

Personal tools