Users REST interface¶
Warning
All of /API/v1/
is deprecated and will be removed in Portal 5.0.0. Please see the V2 APIs for replacements
if you are still using an /API/V1/
-endpoint.
RESTful API for the UserProfile and UserAccountProfile¶
UserProfile is a model which extends User resources from external backend systems and our internal User object.. All UserProfile’s resources are limited to only those users that have the ‘userprofile’ or superuser permissions. UserAccountProfile will is the resource for the authenticating user’s UserProfile object. Response Formats: JSON
Resource GET /API/v1/userprofile/%id/¶
- Response Formats:
- JSON
- Resource URL:
- /API/v1/userprofile/%id/
- Schema URL:
- /API/v1/userprofile/schema/
- Permission Required:
- userprofile
Parameters for UserProfile and UserAccountProfile Object
Name | Description | Example |
---|---|---|
id | (Integer) GUID for UserProfile object | 12 |
notes | (String - optional) Text string where notes could be taken on the UserProfile | |
create_date | (DateTimeField) Date the userprofile resource was created in Portal | |
paginate_by | (Integer) number of items per page to show | 15 |
contact_number | (String - Optional) field for storing a phone number | “01 02 235-542” |
extra_info | (JSON data field) JSON data field for storing extra information against a user | |
theme | (Integer - Optional) ID of the theme that the user has selected | 1 |
roles | (Python Object) Roles that the user has got from a integrated backend | |
homepage | (String - Optional) The users preferred homepage | “/vs/search” |
default_inge st_group | (String - Optional) | |
default_group | (String - Optional) | |
default_sort_ list |
|
|
default_ metadata_group | (String - Optional) | |
login_count | (Integer) | |
organisation | (Integer - Maps to Organisation resource) | |
metadata_fields | (Python Object) | |
timeout | (Integer) | |
resource_uri | (URL) |
Example response:
{
"contact_number": "",
"create_date": "2011-08-27T08:18:11.758374",
"default_metadata_group": "Film",
"default_sort_list": "[{'field': u'created',
'order': 'descending'},
{'field': u'originalFilename',
'order': 'descending'},
{'field': u'portal_ingested',
'order': 'descending'},
{'field': u'portal_mf268857',
'order': 'descending'}]",
"extra_info": "{}",
"homepage": "/vs/search/",
"id": "1",
"login_count": 19,
"metadata_fields": "",
"notes": "",
"paginate_by": 15,
"roles": "['_metadata_schema_write', '_collection_notification_read',
'_item_timeline_read',
'_transcoder', '_storage_read', '_import',
'_relation_write', '_lock_read',
'_user', '_item_timeline_write', '_item_notification_write',
'_job_notification_write', '_log_read', '_export',
'_metadata_read',
'_storage_group_write', '_metadata_field_group_write',
'_job_notification_read',
'_resource_write', '_group_write', '_metadata_field_read',
'_metadata_schema_read', '_item_id_write',
'_metadata_field_group_read',
'_storage_notification_write', '_library_write',
'_collection_read',
'_item_shape_read', '_relation_read', '_job_write',
'_storage_rule_read',
'_transfer_write', '_sequence_write', '_item_uri',
'_metadata_write',
'_file_notification_write', '_administrator',
'_thumbnail_read',
'_storage_group_read', '_file_write', '_item_search',
'_metadata_global_write',
'_shape_tag_read', '_accesscontrol_write', '_library_read',
'_group_read',
'_item_notification_read', '_metadata_field_write',
'_storage_write',
'_shape_tag_write', '_taskdefinition_write',
'_lock_write', '_projection_write',
'_file_notification_read', '_external_id_write',
'_metadata_lock_read',
'_item_id_read', '_storage_notification_read',
'_storage_rule_write',
'_resource_read', '_collection_write', '_job_read',
'_file_read',
'_external_id_read', '_projection_read',
'_accesscontrol_read',
'_sequence_read', '_collection_notification_write',
'_thumbnail_write',
'_metadata_lock_write', '_item_shape_write',
'_transfer_read',
'_taskdefinition_read', '_metadata_global_read',
'_super_access_user']",
"timeout": 7,
"user": {
"date_joined": "2011-08-27T08:18:11.748380",
"first_name": "",
"id": "1",
"is_active": true,
"is_staff": true,
"last_login": "2011-09-12T22:19:05.393574",
"last_name": "",
"resource_uri": "",
"username": "admin"
}
}
Resource GET /API/v1/userprofile/¶
Returns a list of userprofile items for the user the current authenticated user.
- Response Formats:
- JSON
- Resource URL:
- /API/v1/userprofile/
- Schema URL:
- /API/v1/userprofile/schema/
- Permission Required:
- userprofile
- Parameters for meta *
Name | Description | Example |
---|---|---|
limit | (Integer) Usual offset limit for pagination | 20 |
next | (URI) Next | null |
offset | (Integer) First item on the page | 20 |
previous | (URI) Next | null |
total | (Integer) Total amount of items in the UserProfile for this user | 20 |
Example response:
{
"meta": {
"limit": 20,
"next": null,
"offset": 0,
"previous": null,
"total_count": 4
},
"objects": [
{
"contact_number": "",
"create_date": "2011-08-31T13:08:56.962532",
"default_metadata_group": null,
"default_sort_list": "",
"extra_info": "{}",
"homepage": "/vs/search/",
"id": "2",
"login_count": 0,
"metadata_fields": "",
"notes": "",
"paginate_by": 15,
"roles": "",
"timeout": 7,
"user": {
"date_joined": "2011-08-31T13:08:56.945750",
"first_name": "",
"id": "2",
"is_active": false,
"is_staff": false,
"last_login": "2011-08-31T13:08:56.945741",
"last_name": "",
"resource_uri": "",
"username": "test"
}
},
{
"contact_number": null,
"create_date": "2011-09-01T13:39:33.170379",
"default_metadata_group": null,
"default_sort_list": "",
"extra_info": "{}",
"homepage": "/vs/search/",
"id": "4",
"login_count": 0,
"metadata_fields": "",
"notes": "",
"paginate_by": 15,
"roles": "",
"timeout": 7,
"user": {
"date_joined": "2011-09-01T13:39:32.959300",
"first_name": "",
"id": "4",
"is_active": true,
"is_staff": false,
"last_login": "2011-09-01T13:39:32.959289",
"last_name": "",
"resource_uri": "",
"username": "demo"
}
},
{
"contact_number": null,
"create_date": "2011-09-01T11:19:55.312951",
"default_metadata_group": null,
"default_sort_list": "",
"extra_info": "{}",
"homepage": "/vs/search/",
"id": "3",
"login_count": 1,
"metadata_fields": "",
"notes": "",
"paginate_by": 15,
"roles": "['_metadata_schema_write',
'_collection_notification_read',
'_item_timeline_read',
'_storage_read',
'_import',
'_relation_write',
'_lock_read',
'_user',
'_item_timeline_write',
'_item_notification_write',
'_job_notification_write',
'_log_read',
'_export',
'_metadata_read',
'_storage_group_write',
'_metadata_field_group_write',
'_job_notification_read',
'_resource_write',
'_group_write',
'_metadata_field_read',
'_metadata_schema_read',
'_item_id_write',
'_metadata_field_group_read',
'_storage_notification_write',
'_library_write',
'_collection_read',
'_item_shape_read',
'_relation_read',
'_job_write',
'_storage_rule_read',
'_transfer_write',
'_sequence_write',
'_item_uri',
'_metadata_write',
'_file_notification_write',
'_thumbnail_read',
'_storage_group_read',
'_file_write',
'_item_search',
'_metadata_global_write',
'_shape_tag_read',
'_library_read',
'_accesscontrol_write',
'_group_read',
'_item_notification_read',
'_metadata_field_write',
'_storage_write',
'_shape_tag_write',
'_taskdefinition_write',
'_projection_write',
'_lock_write',
'_file_notification_read',
'_external_id_write',
'_metadata_lock_read',
'_item_id_read',
'_storage_notification_read',
'_storage_rule_write',
'_resource_read',
'_collection_write',
'_job_read',
'_file_read',
'_external_id_read',
'_projection_read',
'_accesscontrol_read',
'_sequence_read',
'_collection_notification_write',
'_thumbnail_write',
'_metadata_lock_write',
'_item_shape_write',
'_transfer_read',
'_taskdefinition_read',
'_metadata_global_read']",
"timeout": 7,
"user": {
"date_joined": "2011-09-01T11:19:55.293601",
"first_name": "",
"id": "3",
"is_active": true,
"is_staff": false,
"last_login": "2011-09-12T22:19:44.242133",
"last_name": "",
"resource_uri": "",
"username": "tim"
}
},
{
"contact_number": "",
"create_date": "2011-08-27T08:18:11.758374",
"default_metadata_group": "Film",
"default_sort_list": "[{'field': u'created',
'order': 'descending'},
{'field': u'originalFilename',
'order': 'descending'},
{'field': u'portal_ingested',
'order': 'descending'},
{'field': u'portal_mf268857',
'order': 'descending'}]",
"extra_info": "{}",
"homepage": "/vs/search/",
"id": "1",
"login_count": 19,
"metadata_fields": "",
"notes": "",
"paginate_by": 15,
"roles": "['_metadata_schema_write',
'_collection_notification_read',
'_item_timeline_read',
'_transcoder',
'_storage_read',
'_import',
'_relation_write',
'_lock_read',
'_user',
'_item_timeline_write',
'_item_notification_write',
'_job_notification_write',
'_log_read',
'_export',
'_metadata_read',
'_storage_group_write',
'_metadata_field_group_write',
'_job_notification_read',
'_resource_write',
'_group_write',
'_metadata_field_read',
'_metadata_schema_read',
'_item_id_write',
'_metadata_field_group_read',
'_storage_notification_write',
'_library_write',
'_collection_read',
'_item_shape_read',
'_relation_read',
'_job_write',
'_storage_rule_read',
'_transfer_write',
'_sequence_write',
'_item_uri',
'_metadata_write',
'_file_notification_write',
'_administrator',
'_thumbnail_read',
'_storage_group_read',
'_file_write',
'_item_search',
'_metadata_global_write',
'_shape_tag_read',
'_accesscontrol_write',
'_library_read',
'_group_read',
'_item_notification_read',
'_metadata_field_write',
'_storage_write',
'_shape_tag_write',
'_taskdefinition_write',
'_lock_write',
'_projection_write',
'_file_notification_read',
'_external_id_write',
'_metadata_lock_read',
'_item_id_read',
'_storage_notification_read',
'_storage_rule_write',
'_resource_read',
'_collection_write',
'_job_read',
'_file_read',
'_external_id_read',
'_projection_read',
'_accesscontrol_read',
'_sequence_read',
'_collection_notification_write',
'_thumbnail_write',
'_metadata_lock_write',
'_item_shape_write',
'_transfer_read',
'_taskdefinition_read',
'_metadata_global_read',
'_super_access_user']",
"timeout": 7,
"user": {
"date_joined": "2011-08-27T08:18:11.748380",
"first_name": "",
"id": "1",
"is_active": true,
"is_staff": true,
"last_login": "2011-09-12T22:19:05.393574",
"last_name": "",
"resource_uri": "",
"username": "admin"
}
}
]
}
Resource GET /API/v1/useraccountprofile/¶
When wanting to current authenticated user’s UserProfile.
- Response Formats:
- JSON
- Resource URL:
- /API/v1/useraccountprofile/
- Schema URL:
- /API/v1/useraccountprofile/schema/
- Permission Required:
- Authenticated User
Example response (Status Code 200):
{
"meta": {
"limit": 20,
"next": null,
"offset": 0,
"previous": null,
"total_count": 1
},
"objects": [
{
"contact_number": "",
"create_date": "2011-08-27T08:18:11.758374",
"default_metadata_group": "Film",
"default_sort_list": "[{'field': u'created',
'order': 'descending'}, {'field': u'originalFilename',
'order': 'descending'}, {'field': u'portal_ingested',
'order': 'descending'}, {'field': u'portal_mf268857',
'order': 'descending'}]",
"extra_info": "{}",
"homepage": "/vs/search/",
"id": "1",
"login_count": 19,
"metadata_fields": "",
"notes": "",
"paginate_by": 15,
"resource_uri": "/API/v1/useraccountprofile/1/",
"roles": "['_metadata_schema_write',
'_collection_notification_read',
'_item_timeline_read', '_transcoder',
'_storage_read', '_import', '_relation_write',
'_lock_read', '_user', '_item_timeline_write',
'_item_notification_write',
'_job_notification_write', '_log_read', '_export',
'_metadata_read', '_storage_group_write',
'_metadata_field_group_write',
'_job_notification_read', '_resource_write',
'_group_write', '_metadata_field_read',
'_metadata_schema_read', '_item_id_write',
'_metadata_field_group_read',
'_storage_notification_write', '_library_write',
'_collection_read', '_item_shape_read',
'_relation_read', '_job_write', '_storage_rule_read',
'_transfer_write', '_sequence_write', '_item_uri',
'_metadata_write', '_file_notification_write',
'_administrator', '_thumbnail_read',
'_storage_group_read', '_file_write',
'_item_search', '_metadata_global_write',
'_shape_tag_read', '_accesscontrol_write',
'_library_read', '_group_read',
'_item_notification_read', '_metadata_field_write',
'_storage_write', '_shape_tag_write',
'_taskdefinition_write', '_lock_write',
'_projection_write', '_file_notification_read',
'_external_id_write', '_metadata_lock_read',
'_item_id_read', '_storage_notification_read',
'_storage_rule_write', '_resource_read',
'_collection_write', '_job_read', '_file_read',
'_external_id_read', '_projection_read',
'_accesscontrol_read', '_sequence_read',
'_collection_notification_write',
'_thumbnail_write', '_metadata_lock_write',
'_item_shape_write', '_transfer_read',
'_taskdefinition_read', '_metadata_global_read',
'_super_access_user']",
"timeout": 7
}
]
}
Resource GET /API/v1/groupprofile/¶
For querying the extended information on Groups.
- Response Formats:
- JSON
- Resource URL:
- /API/v1/groupprofile/
- Schema URL:
- /API/v1/groupprofile/schema/
- Permission Required:
- user
Example response (Status Code 200):
Resource GET /API/v1/userroles/¶
Lists all the internally stored UserRoles
- Response Formats:
- JSON
- Resource URL:
- /API/v1/userroles/
- Schema URL:
- /API/v1/userroles/schema/
- Permission Required:
- user
- Allowed List Methods:
- GET
- Object Limit:
- 1000
Example response (Status Code 200):
{
"meta": {
"limit": 1000,
"next": null,
"offset": 0,
"previous": null,
"total_count": 77
},
"objects": [
{
"key": "_log_read",
"value": "Read log"
},
{
"key": "_shape_tag_read",
"value": "Read shape tag"
},
{
"key": "_metadata_lock_write",
"value": "Write metadata lock"
},
{
"key": "_transfer_read",
"value": "Read transfer"
},
{
"key": "_storage_group_read",
"value": "Read storage group"
},
{
"key": "_group_read",
"value": "Read group"
},
{
"key": "_file_write",
"value": "Write file"
},
{
"key": "_group_write",
"value": "Write group"
},
{
"key": "_thumbnail_write",
"value": "Write thumbnail"
},
{
"key": "_projection_read",
"value": "Read projection"
},
{
"key": "_file_read",
"value": "Read file"
},
{
"key": "_collection_notification_read",
"value": "Read collection notification"
},
{
"key": "_metadata_field_group_read",
"value": "Read metadata field group"
},
{
"key": "_file_notification_read",
"value": "Read file notification"
},
{
"key": "_item_id_read",
"value": "Read item ID"
},
{
"key": "_relation_read",
"value": "Read relation"
},
{
"key": "_item_shape_read",
"value": "Read item shape"
},
{
"key": "_resource_read",
"value": "Read resource"
},
{
"key": "_storage_group_write",
"value": "Write storage group"
},
{
"key": "_projection_write",
"value": "Write projection"
},
{
"key": "_file_notification_write",
"value": "Write file notification"
},
{
"key": "_storage_notification_write",
"value": "Write storage notification"
},
{
"key": "_storage_write",
"value": "Write storage"
},
{
"key": "_transfer_write",
"value": "Write transfer"
},
{
"key": "_taskdefinition_write",
"value": "Write task definition"
},
{
"key": "_super_access_user",
"value": "Super user access all"
},
{
"key": "_storage_notification_read",
"value": "Read storage notification"
},
{
"key": "_job_notification_write",
"value": "Write job notification"
},
{
"key": "_metadata_field_group_write",
"value": "Write metadata field group"
},
{
"key": "_thumbnail_read",
"value": "Read thumbnail"
},
{
"key": "_storage_rule_write",
"value": "Write storage rule"
},
{
"key": "_job_notification_read",
"value": "Read job notification"
},
{
"key": "_administrator",
"value": "Administrator"
},
{
"key": "_item_timeline_read",
"value": "Read item timeline"
},
{
"key": "_library_read",
"value": "Read library"
},
{
"key": "_metadata_schema_write",
"value": "Write metadata schema"
},
{
"key": "_storage_read",
"value": "Read storage"
},
{
"key": "_item_shape_write",
"value": "Write item shape"
},
{
"key": "_item_notification_read",
"value": "Read item notification"
},
{
"key": "_item_search",
"value": "Item search"
},
{
"key": "_sequence_read",
"value": "Read sequence"
},
{
"key": "_accesscontrol_read",
"value": "Read access control"
},
{
"key": "_relation_write",
"value": "Write relation"
},
{
"key": "_metadata_lock_read",
"value": "Read metadata lock"
},
{
"key": "_shape_tag_write",
"value": "Write shape tag"
},
{
"key": "_accesscontrol_write",
"value": "Write access control"
},
{
"key": "_transcoder",
"value": "Transcoder"
},
{
"key": "_export",
"value": "Export"
},
{
"key": "_user",
"value": "User"
},
{
"key": "_metadata_field_read",
"value": "Read metadata field"
},
{
"key": "_metadata_field_write",
"value": "Write metadata field"
},
{
"key": "_job_read",
"value": "Read job"
},
{
"key": "_import",
"value": "Import/ingest"
},
{
"key": "_metadata_global_write",
"value": "Write global metadata"
},
{
"key": "_taskdefinition_read",
"value": "Read task definition"
},
{
"key": "_metadata_global_read",
"value": "Read global metadata"
},
{
"key": "_lock_read",
"value": "Read lock"
},
{
"key": "_collection_read",
"value": "Read collection"
},
{
"key": "_item_uri",
"value": "Item URI"
},
{
"key": "_metadata_schema_read",
"value": "Read metadata schema"
},
{
"key": "_site_rule_write",
"value": "Write site rule"
},
{
"key": "_resource_write",
"value": "Write resource"
},
{
"key": "_item_notification_write",
"value": "Write item notification"
},
{
"key": "_library_write",
"value": "Write library"
},
{
"key": "_item_timeline_write",
"value": "Write item timeline"
},
{
"key": "_job_write",
"value": "Write job"
},
{
"key": "_site_rule_read",
"value": "Read site rule"
},
{
"key": "_external_id_read",
"value": "Read external ID"
},
{
"key": "_sequence_write",
"value": "Write sequence"
},
{
"key": "_external_id_write",
"value": "Write external ID"
},
{
"key": "_metadata_read",
"value": "Read metadata"
},
{
"key": "_storage_rule_read",
"value": "Read storage rule"
},
{
"key": "_collection_notification_write",
"value": "Write collection notification"
},
{
"key": "_metadata_write",
"value": "Write metadata"
},
{
"key": "_item_id_write",
"value": "Write item ID"
},
{
"key": "_lock_write",
"value": "Write lock"
},
{
"key": "_collection_write",
"value": "Write collection"
}
]
}
-
class
portal.users.api.
GroupProfileResource
(api_name=None)¶ Handles checking of permissions to see if the user has authorization to GET this resource.
-
class
portal.users.api.
GroupResource
(api_name=None)¶
-
class
portal.users.api.
UserAccountProfileResource
(api_name=None)¶ Limit this to authenticated users…
-
class
portal.users.api.
UserProfileResource
(api_name=None)¶ Limit this to users with the theme or superuser privilege…
-
post_list
(request, **kwargs)¶ Custom method to return what has been created from the POST response
-
class
portal.users.api.
UserResource
(api_name=None)¶ Limit this to users with the theme or superuser privilege…
-
hydrate_m2m
(bundle)¶ Populate the ManyToMany data on the instance.
-
class
portal.users.api.
UserRolesResource
(api_name=None)¶ Limit this to users with the theme or superuser privilege…
-
get_object_list
(request)¶ A hook to allow making returning the list of available objects.
This needs to be implemented at the user level.
ModelResource
includes a full working version specific to Django’sModels
.
-
obj_get_list
(request=None, **kwargs)¶ Fetches the list of objects available on the resource.
This needs to be implemented at the user level.
ModelResource
includes a full working version specific to Django’sModels
.
-
rollback
(bundles)¶ Given the list of bundles, delete all objects pertaining to those bundles.
This needs to be implemented at the user level. No exceptions should be raised if possible.
ModelResource
includes a full working version specific to Django’sModels
.