Alert

From ToxBank API Wiki
Jump to: navigation, search
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