Alert

From ToxBank API Wiki
(Difference between revisions)
Jump to: navigation, search
(cURL example)
(cURL example)
Line 21: Line 21:
 
  $curl -X GET http://toxbanktest1.opentox.org:8080/toxbank/user/U2/alert/A105 -H "Accept:text/n3"  
 
  $curl -X GET http://toxbanktest1.opentox.org:8080/toxbank/user/U2/alert/A105 -H "Accept:text/n3"  
  
 +
<pre>
 
@prefix tb: <http://onto.toxbank.net/api/> .
 
@prefix tb: <http://onto.toxbank.net/api/> .
 
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
 
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
Line 46: Line 47:
 
ncal:hourly
 
ncal:hourly
 
a ncal:RecurrenceFrequency .
 
a ncal:RecurrenceFrequency .
 +
</pre<
  
 
== Create an alert ==
 
== Create an alert ==

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 .
</pre<

== Create an alert ==
{{HasOperation |id=API_Alert_Create}}

=== 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 ==
{{HasOperation |id=API_Alert_Retrieve}}

== Update an Alert ==
{{HasOperation |id=API_Alert_Update}}

== Delete an Alert ==
{{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&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