User Tools


List Projects

Back to JEA API docs


A checked-in user can list his own (with own) and all projects that are shared with him (with all) using the List Projects command. A valid JWT token must be included in the header, otherwise the transaction will be rejected with an HTTP 401 Unauthorized error code. Successful operation returns a list of project IDs.

Synopsis

Project ID

A Project ID is a text string that you have assigned to the project on its creation. This string must uniquely identify the project in your own collection. All projects owned by others have the owner's ID (normally the email address) included as a prefix to the project ID. For example:

yi@jeplus.org(~)circle

is a project named “circle”, created by “yi@jeplus.org”

Project list

Successful operation of the command returns a list of project IDs, as seen in the example here:

[
  "Office-v8-2",
  "Office-v80",
  "PyWWR",
  "PyWWR2_large upload",
  "TruncatedSampling",
  "circle",
  "gramrui@unav.es(~)Test_1",
  "yi@jeplus.org(~)H-Sphere",
  "yi@jeplus.org(~)H-Sphere_1-8",
  "yi@jeplus.org(~)H-Sphere_17-22",
  "yi@jeplus.org(~)H-Sphere_9-16",
  "yi@jeplus.org(~)House detailed",
  "yi@jeplus.org(~)Project-2017-09-14_14.45.51.253",
  "yi@jeplus.org(~)circle",
  "yi@jeplus.org(~)circle-sample-100"
]

Example using curl://

To send the List Own Projects command using curl:

curl -H "Authorization:Bearer eyJraWQiOiIxNTAyMzE2Mz...Qons9gjFXUrpQ" http://jea.ensims.com/users/api/projects/own

On successful operation, a list of project IDs owned by the user is returned. If the existing JWT is invalid, an HTTP 401 Unauthorized code will be returned.

To send the List All Projects command using curl:

curl -H "Authorization:Bearer eyJraWQiOiIxNTAyMzE2Mz...Qons9gjFXUrpQ" http://jea.ensims.com/users/api/projects/all

On successful operation, a list of project IDs owned by or shared with the user is returned. If the existing JWT is invalid, an HTTP 401 Unauthorized code will be returned.

Example using Python Requests

Make sure Requests is correctly installed in your Python environment, and run the following the lines:

import requests

jwt = 'eyJraWQiOiIxNTAyMzE2MzY...JEwH4KoyBqDDTkfjmsQons9gjFXUrpQ'
headers = {'Authorization': 'Bearer ' + jwt}
body = {}

# List own projects
r = requests.get('http://jea.ensims.com/users/api/projects/own', headers=headers, json=body)

# List all projects
r = requests.get('http://jea.ensims.com/users/api/projects/all', headers=headers, json=body)
  
r.json()


Site Tools