Project

From ToxBank API Wiki
(Difference between revisions)
Jump to: navigation, search
m
(Security)
 
(11 intermediate revisions by one user not shown)
Line 6: Line 6:
 
A [[Protocol]] is always associated with a project,and the protocol representation includes a link to a Project.
 
A [[Protocol]] is always associated with a project,and the protocol representation includes a link to a Project.
  
== REST Operations ==
+
= REST Operations =
  
=== GET: Retrieve all projects ===
+
== GET: Retrieve all projects ==
 
{{REST Operations
 
{{REST Operations
 
|REST_op_description=Retrieves available projects
 
|REST_op_description=Retrieves available projects
Line 14: Line 14:
 
|REST_op_method=GET
 
|REST_op_method=GET
 
|REST_op_uri=/project
 
|REST_op_uri=/project
|REST_op_params=none, or ?search=name
+
|REST_op_params=none, or ?search=prefix_name or paging parameters: page, pagesize
 
|REST_header_param=subjectid:SECURITY-TOKEN
 
|REST_header_param=subjectid:SECURITY-TOKEN
 
|REST_op_mime_input=none
 
|REST_op_mime_input=none
Line 22: Line 22:
 
}}
 
}}
 
Example: [http://toxbanktest1.opentox.org:8080/toxbank/project http://toxbanktest1.opentox.org:8080/toxbank/project]
 
Example: [http://toxbanktest1.opentox.org:8080/toxbank/project http://toxbanktest1.opentox.org:8080/toxbank/project]
 
+
=== cURL example ===
 
  curl -X GET -H 'Accept:text/uri-list' -H 'subjectid:TOKEN' http://toxbanktest1.opentox.org:8080/toxbank/project
 
  curl -X GET -H 'Accept:text/uri-list' -H 'subjectid:TOKEN' http://toxbanktest1.opentox.org:8080/toxbank/project
  
 
  curl -X GET -H 'Accept:application/rdf+xml' -H 'subjectid:TOKEN' http://toxbanktest1.opentox.org:8080/toxbank/project?search=Tox
 
  curl -X GET -H 'Accept:application/rdf+xml' -H 'subjectid:TOKEN' http://toxbanktest1.opentox.org:8080/toxbank/project?search=Tox
  
=== GET: Retrieve a single project ===
+
curl -X GET -H 'Accept:text/uri-list' -H 'subjectid:TOKEN' http://toxbanktest1.opentox.org:8080/toxbank/project?page=0&pagesize=5
 +
 
 +
== GET: Retrieve a single project ==
 
{{REST Operations
 
{{REST Operations
 
|REST_op_description=Retrieves a single project
 
|REST_op_description=Retrieves a single project
Line 33: Line 35:
 
|REST_op_method=GET
 
|REST_op_method=GET
 
|REST_op_uri=/project/{id}
 
|REST_op_uri=/project/{id}
|REST_op_params=none, or ?search=name
+
|REST_op_params=none
 
|REST_header_param=subjectid:SECURITY-TOKEN
 
|REST_header_param=subjectid:SECURITY-TOKEN
 
|REST_op_mime_input=none
 
|REST_op_mime_input=none
Line 41: Line 43:
 
}}
 
}}
 
Example: [http://toxbanktest1.opentox.org:8080/toxbank/project/G1 http://toxbanktest1.opentox.org:8080/toxbank/project/G1]
 
Example: [http://toxbanktest1.opentox.org:8080/toxbank/project/G1 http://toxbanktest1.opentox.org:8080/toxbank/project/G1]
 
+
=== cURL example ===
 
  curl -X GET -H 'Accept:application/rdf+xml' -H 'subjectid:TOKEN' http://toxbanktest1.opentox.org:8080/toxbank/project/G1
 
  curl -X GET -H 'Accept:application/rdf+xml' -H 'subjectid:TOKEN' http://toxbanktest1.opentox.org:8080/toxbank/project/G1
  
===POST: Create a project ===
+
==POST: Create a project ==
 
{{REST Operations
 
{{REST Operations
 
|REST_op_description=Creates a project
 
|REST_op_description=Creates a project
Line 58: Line 60:
 
}}
 
}}
 
Example: [http://toxbanktest1.opentox.org:8080/toxbank/project?new=true http://toxbanktest1.opentox.org:8080/toxbank/project]
 
Example: [http://toxbanktest1.opentox.org:8080/toxbank/project?new=true http://toxbanktest1.opentox.org:8080/toxbank/project]
 
+
=== cURL example ===
 
  curl -X POST -H 'subjectid:TOKEN' -H 'Content-Type:application/x-www-form-urlencoded' \
 
  curl -X POST -H 'subjectid:TOKEN' -H 'Content-Type:application/x-www-form-urlencoded' \
 
         -d 'title=MANDATORY_VALUE' -d  'ldapgroup=OPTIONAL_VALUE' http://toxbanktest1.opentox.org:8080/toxbank/project
 
         -d 'title=MANDATORY_VALUE' -d  'ldapgroup=OPTIONAL_VALUE' http://toxbanktest1.opentox.org:8080/toxbank/project
  
===PUT: Update a project ===
+
==PUT: Update a project ==
 
{{REST Operations
 
{{REST Operations
 
|REST_op_description=Updates the project metadata
 
|REST_op_description=Updates the project metadata
 +
|REST_resource=Project
 
|REST_op_method=PUT
 
|REST_op_method=PUT
 
|REST_op_uri=/project/{id}
 
|REST_op_uri=/project/{id}
Line 74: Line 77:
 
|REST_op_status=200,202,400,401,402,403,500
 
|REST_op_status=200,202,400,401,402,403,500
 
}}
 
}}
 
+
=== cURL example ===
Example:
+
 
+
 
  curl -X PUT -H 'subjectid:TOKEN' -H 'Content-Type:application/x-www-form-urlencoded' \
 
  curl -X PUT -H 'subjectid:TOKEN' -H 'Content-Type:application/x-www-form-urlencoded' \
 
         -d 'title=MANDATORY_VALUE' -d  'ldapgroup=OPTIONAL_VALUE' http://toxbanktest1.opentox.org:8080/toxbank/project/G3
 
         -d 'title=MANDATORY_VALUE' -d  'ldapgroup=OPTIONAL_VALUE' http://toxbanktest1.opentox.org:8080/toxbank/project/G3
  
===DELETE: Delete a project ===
+
==DELETE: Delete a project ==
 
{{REST Operations
 
{{REST Operations
 
|REST_op_description=Removes an existing project
 
|REST_op_description=Removes an existing project
 +
|REST_resource=Project
 
|REST_op_method=DELETE
 
|REST_op_method=DELETE
 
|REST_op_uri=/project/{id}
 
|REST_op_uri=/project/{id}
Line 92: Line 94:
 
|REST_op_status=200,202,400,401,402,403,500
 
|REST_op_status=200,202,400,401,402,403,500
 
}}
 
}}
 
+
=== cURL example ===
Example:
+
 
+
 
  curl -X DELETE -H 'subjectid:TOKEN' http://toxbanktest1.opentox.org:8080/toxbank/project/G3
 
  curl -X DELETE -H 'subjectid:TOKEN' http://toxbanktest1.opentox.org:8080/toxbank/project/G3
  
 
== RDF representation ==
 
== RDF representation ==
  
[http://jenkins.toxbank.net/job/toxbank-api-beans/ws/target/test-classes/net.toxbank.client.resource.Project.7.n3 RDF N3]
+
== Stable version ==
 +
[http://jenkins.toxbank.net/job/production-toxbank-api-beans/ws/target/test-classes/net.toxbank.client.resource.Project.9.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.Project.9.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.Project.9.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 xsd 'http://www.w3.org/2001/XMLSchema#'>
 +
  <!ENTITY tbo 'http://toxbanktest1.opentox.org:8080/toxbank/organisation/'>
 +
  <!ENTITY rdf 'http://www.w3.org/1999/02/22-rdf-syntax-ns#'>
 +
  <!ENTITY tbpt 'http://toxbanktest1.opentox.org:8080/toxbank/project/'>
 +
  <!ENTITY dcterms 'http://purl.org/dc/terms/'>]>
 +
<rdf:RDF
 +
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
 +
    xmlns:tbo="&tbo;"
 +
    xmlns:dcterms="&dcterms;"
 +
    xmlns:xsd="&xsd;"
 +
    xmlns:tbpt="&tbpt;"
 +
    xmlns:tb="&tb;">
 +
  <tb:Project rdf:about="&tbpt;G2">
 +
    <tb:subOrganisationOf rdf:resource="SEURAT-1"/>
 +
    <tb:hasAccount rdf:datatype="&xsd;string">toxbank</tb:hasAccount>
 +
    <dcterms:title rdf:datatype="&xsd;string">ToxBank</dcterms:title>
 +
  </tb:Project>
 +
</rdf:RDF>
 +
</pre>
 +
 
 +
= Security =
 +
 
 +
==== SEURAT-1 access  ====
 +
 
 +
Project information can be retrieved by members of groups scrtox,hemibio,notox,cosmos,toxbank,detective,sep.
  
This RDF representation is automatically generated by the latesr version of the [https://github.com/ToxBank/toxbank-api-beans Toxbank Java client library]
+
The policies can be browsed
 +
[https://services.toxbank.net/toxbank/admin/policy?search=https%3A%2F%2Fservices.toxbank.net%2Ftoxbank%2Fproject here].

Latest revision as of 11:15, 5 February 2013

Project


A project is a REST resource,representing projects from SEURAT cluster, or external projects. A project is identified by its URI, has a name and may be assigned an LDAP group. The LDAP group should be one of the existing ToxBank LDAP groups and accessible via ToxBank OpenAM. External projects may or may not be assigned an LDAP group.

A Protocol is always associated with a project,and the protocol representation includes a link to a Project.

Contents

REST Operations

GET: Retrieve all projects

Description Retrieves available projects
Resource Project
Method GET
URI /project
Parameters none, or ?search=prefix_name or paging parameters: page, pagesize
Header Parameters subjectid:SECURITY-TOKEN
Media Type (input) none
Results The project representation in supported media type
Media Type (output) application/rdf+xml;text/n3;text/uri-list
Status code 200,400,401,402,403

Example: http://toxbanktest1.opentox.org:8080/toxbank/project

cURL example

curl -X GET -H 'Accept:text/uri-list' -H 'subjectid:TOKEN' http://toxbanktest1.opentox.org:8080/toxbank/project
curl -X GET -H 'Accept:application/rdf+xml' -H 'subjectid:TOKEN' http://toxbanktest1.opentox.org:8080/toxbank/project?search=Tox
curl -X GET -H 'Accept:text/uri-list' -H 'subjectid:TOKEN' http://toxbanktest1.opentox.org:8080/toxbank/project?page=0&pagesize=5

GET: Retrieve a single project

Description Retrieves a single project
Resource Project
Method GET
URI /project/{id}
Parameters none
Header Parameters subjectid:SECURITY-TOKEN
Media Type (input) none
Results The project representation in supported media type
Media Type (output) application/rdf+xml;text/n3;text/uri-list
Status code 200,400,401,402,403

Example: http://toxbanktest1.opentox.org:8080/toxbank/project/G1

cURL example

curl -X GET -H 'Accept:application/rdf+xml' -H 'subjectid:TOKEN' http://toxbanktest1.opentox.org:8080/toxbank/project/G1

POST: Create a project

Description Creates a project
Resource Project
Method POST
URI /project
Parameters Any combination of name,ldapgroup
Header Parameters subjectid:SECURITY-TOKEN
Media Type (input) application/x-www-form-urlencoded
Results Task representation in supported MIME formats
Media Type (output) application/rdf+xml;text/n3;text/uri-list
Status code 200,202,400,401,402,403,500

Example: http://toxbanktest1.opentox.org:8080/toxbank/project

cURL example

curl -X POST -H 'subjectid:TOKEN' -H 'Content-Type:application/x-www-form-urlencoded' \
       -d 'title=MANDATORY_VALUE' -d  'ldapgroup=OPTIONAL_VALUE' http://toxbanktest1.opentox.org:8080/toxbank/project

PUT: Update a project

Description Updates the project metadata
Resource Project
Method PUT
URI /project/{id}
Parameters Any combination of name,ldapgroup
Header Parameters subjectid:SECURITY-TOKEN
Media Type (input) application/x-www-form-urlencoded
Results Task representation in supported MIME formats
Media Type (output) application/rdf+xml;text/n3;text/uri-list
Status code 200,202,400,401,402,403,500

cURL example

curl -X PUT -H 'subjectid:TOKEN' -H 'Content-Type:application/x-www-form-urlencoded' \
       -d 'title=MANDATORY_VALUE' -d  'ldapgroup=OPTIONAL_VALUE' http://toxbanktest1.opentox.org:8080/toxbank/project/G3

DELETE: Delete a project

Description Removes an existing project
Resource Project
Method DELETE
URI /project/{id}
Parameters none
Header Parameters subjectid:SECURITY-TOKEN
Media Type (input) none
Results Task representation in supported MIME formats
Media Type (output) application/rdf+xml;text/n3;text/uri-list
Status code 200,202,400,401,402,403,500

cURL example

curl -X DELETE -H 'subjectid:TOKEN' http://toxbanktest1.opentox.org:8080/toxbank/project/G3

RDF representation

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 xsd 'http://www.w3.org/2001/XMLSchema#'>
  <!ENTITY tbo 'http://toxbanktest1.opentox.org:8080/toxbank/organisation/'>
  <!ENTITY rdf 'http://www.w3.org/1999/02/22-rdf-syntax-ns#'>
  <!ENTITY tbpt 'http://toxbanktest1.opentox.org:8080/toxbank/project/'>
  <!ENTITY dcterms 'http://purl.org/dc/terms/'>]>
<rdf:RDF
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:tbo="&tbo;"
    xmlns:dcterms="&dcterms;"
    xmlns:xsd="&xsd;"
    xmlns:tbpt="&tbpt;"
    xmlns:tb="&tb;">
  <tb:Project rdf:about="&tbpt;G2">
    <tb:subOrganisationOf rdf:resource="SEURAT-1"/>
    <tb:hasAccount rdf:datatype="&xsd;string">toxbank</tb:hasAccount>
    <dcterms:title rdf:datatype="&xsd;string">ToxBank</dcterms:title>
  </tb:Project>
</rdf:RDF>

Security

SEURAT-1 access

Project information can be retrieved by members of groups scrtox,hemibio,notox,cosmos,toxbank,detective,sep.

The policies can be browsed here.

Personal tools