Skip to content

Access Request Manipulation

Steve Nolen edited this page Mar 31, 2016 · 1 revision

What does it do?

Creates an access request with detail on the access type and how the user plan to use the privileges (i.e. project name, project objectives, deployment time frame). The content will be reviewed by the system provider who will determine whether the request should be granted. If granted, the user will have to privilege to create groups (i.e. class) along with users associated with the groups.

URI

access_request/create

Access Rules

Any existing user may create the request.

Input Parameters

  • (r) auth_token = The authentication token.
  • (r) client = A string representing the client.
  • (r) uuid = The request UUID to be used as the identifier.
  • (r) email_address = The requester's email address for receiving email notifications.
  • (r) type = The access request type. Currently only 'user_setup' is supported.
  • (r) content = A JSON object that contains the description of how the user plans to use this privilege. The system expects a "content" element which is a JSON array. Here is an example:
     {
        "request" : [
          {"Project Name":"Computer Science P1"}, 
          {"Objectives":"To use the tools to teach concepts in my computer science class. Students will be creating their own data collection campaigns, collect data, and analyze their own data."}, 
          {"Number of participants":"Around 30-40 students"}, 
          {"Deployment":"I plan to use this between Aug 2015 - Dect 2015."}
        ]
    }

Example POST

POST /app/access_request/create HTTP/1.1
 Host: dev.ohmage.org
 Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/535.7 (KHTML, like Gecko) Chrome/16.0.912.77 Safari/535.7
 Content-Length: byte-length-of-content
 Content-Type: application/x-www-form-urlencoded
 
  auth_token=abcfcd36-ab25-4494-8434-7798cb1d718e
  &client=ohmage-js
  &uuid=925fa340-5e72-0133-4dcb-28d244c2ca8e
  &[email protected]
  &type=user_setup
  &content='{"request":["Project Name":"Computer Science P1", "Objectives":"To use the tools to teach concepts in my computer science class. Students will be creating their own data collection campaigns, collect data, and analyze their own data.", "Number of participants":"Around 30-40 students", "Deployment":"I plan to use this between Aug 2015 - Dect 2015."]}

cURL Example

curl -v -F 'auth_token=6b732614-a81f-426d-aef5-cb65495635cf' -F 'client=curl' -F 'uuid=925fa340-5e72-0133-4dcb-28d244c2ca8e' -F '[email protected]' -F 'content={"content":["Project Name":"Computer Science P1", "Objectives":"To use the tools to teach concepts in my computer science class. Students will be creating their own data collection campaigns, collect data, and analyze their own data.", "Number of participants":"Around 30-40 students", "Deployment":"I plan to use this between Aug 2015 - Dect 2015."]}' https://localhost:8080/app/access_request/create

Output Format

Success

{
    "result" : "success"
}

Failure

See the error page for a description of error codes and their associated descriptions.

↑ Back to Top

What does it do?

Returns request information for one or many requests, depending on the specified parameters.

URI

access_request/read

Access Rules

Admins can read all request information in the system. The request owners can read their requests.

Input Parameters

  • (r) auth_token = The authentication token. May also be set using the Set-Cookie header.
  • (r) client = A string representing the client.
  • (o) request_uuid_list = A comma-separated list of user setup request UUIDs.
  • (o) user_list = A comma-separated list of users to search for the requests.
  • (o) email_address_search = A partial email address limiting the results to only those requests whose email address contains this value. Multiple searching strings are separated by space (e.g. "email1 email2")
  • (o) content_search = A partial content limiting the results to only those requests whose content contains this value. Multiple searching strings are separated by space (e.g. "Project1 Project2")
  • (o) type = Request with a specific type (i.e. user_setup).
  • (o) status = Request with a specific status (i.e. pending/approved/rejected).
  • (o) start_date = The start date of the searching period
  • (o) end_date = The end date of the searching period

Example POST

POST /app/access_request/read HTTP/1.1
 Host: dev.ohmage.org
 Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/535.7 (KHTML, like Gecko) Chrome/16.0.912.77 Safari/535.7
 Content-Length: byte-length-of-content
 Content-Type: application/x-www-form-urlencoded
 
  auth_token=abcfcd36-ab25-4494-8434-7798cb1d718e
  &client=ohmage-client

cURL Example

curl -v -d "auth_token=6b732614-a81f-426d-aef5-cb65495635cf&client=curl" https://localhost:8080/app/access_request/read

Output Format

Success

{
    "result":"success",
    "data": {
      "925fa340-5e72-0133-4dcb-28d244c2ca8e": { 
         "creation_time":"2015-10-26T18:11:54.000-07:00",
         "user":"ohmage.admin",
         "uuid":"925fa340-5e72-0133-4dcb-28d244c2ca8e",
         "status":"rejected"
         "email_address":"[email protected]",
         "content":"{\"content\":[{\"project\":\"Test Project2\"},{\"objective\":\"Test Objective\"}]}"
    }
  }

}

Failure

See the error page for a description of error codes and their associated descriptions.

↑ Back to Top

What does it do?

Allows user setup requests to be modified. The request email address, content, and status can be modified.

URI

access_request/update

Access Rules

Admins may perform any update operation on a class. The request owner can change the email address, request content, but not the request status.

Input Parameters

  • (r) auth_token = The authentication token.
  • (r) client = A string representing the client.
  • (r) uuid = UUID of the user setup request being modified.
  • (o) email_address = A new email address associated with the request.
  • (o) content = A new request description JSON. The content format is the same as the user_setup_request/create.
  • (o) type = The type associated with the request.
  • (o) status = The status associated with the request. Only "pending", "approved", and "rejected" can be used.
  • (o) notify_user = A boolean (true/false) to indicate whether the system should send a notification to the user.

Example POST

POST /app/access_request/update HTTP/1.1
 Host: dev.ohmage.org
 Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/535.7 (KHTML, like Gecko) Chrome/16.0.912.77 Safari/535.7
 Content-Length: byte-length-of-content
 Content-Type: application/x-www-form-urlencoded
 
  auth_token=abcfcd36-ab25-4494-8434-7798cb1d718e
  &client=ohmage-MWoC
  &uuid=925fa340-5e72-0133-4dcb-28d244c2ca8e
  &status=approved

cURL Example

curl -v -d "auth_token=6b732614-a81f-426d-aef5-cb65495635cf&client=curl&uuid=925fa340-5e72-0133-4dcb-28d244c2ca8e&status=approved" https://localhost:8080/app/access_request/update

Output Format

Success

{
    "result" : "success"
}     

Failure

See the error page for a description of error codes and their associated descriptions.

↑ Back to Top

What does it do?

Removes requests from the system.

URI

access_request/delete

Access Rules

Admins may delete any requests. The request owner can delete their requests.

Input Parameters

  • (r) auth_token = The authentication token.
  • (r) client = A string representing the client.
  • (r) request_uuid_list = A comma-separated list of request UUIDs to be deleted. The requester needs to have access to all of them. If one of the UUID is not in the system or if the requester doesn't have access, the request will fail.

Example POST

POST /app/access_request/delete HTTP/1.1
 Host: dev.ohmage.org
 Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/535.7 (KHTML, like Gecko) Chrome/16.0.912.77 Safari/535.7
 Content-Length: byte-length-of-content
 Content-Type: application/x-www-form-urlencoded
 
  auth_token=abcfcd36-ab25-4494-8434-7798cb1d718e
  &client=ohmage-MWoC
  &request_uuid_list=925fa340-5e72-0133-4dcb-28d244c2ca8e

cURL Example

curl -v -d "auth_token=6b732614-a81f-426d-aef5-cb65495635cf&client=curl&request_uuid_list=925fa340-5e72-0133-4dcb-28d244c2ca8e" https://localhost:8080/app/access_request/delete

Output Format

Success

{
    "result" : "success"
}     

Failure

See the error page for a description of error codes and their associated descriptions.

↑ Back to Top