D4Science D4Science Don't have a D4Science account? Create one Could not find what you are looking for? Contact us.

Item's Resource APIs Resource

An Item's Resource is an URL (e.g. URL pointing to a file) and can exists only attached to an item.

GET /items/{ITEM_ID}/resources

Request Parameters
name type description
Authorization header Bearer token, see https://dev.d4science.org/how-to-access-resources
ITEM_ID path
Response Body
media type data type description
application/json;charset=UTF-8 string

Example

Request
GET /items/{ITEM_ID}/resources
Content-Type: */*
Accept: application/json;charset=UTF-8
Authorization: ...

                
...
                
              
Response
HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8

                
...
                
              

POST /items/{ITEM_ID}/resources

An Resource is mainly described by the following attributes (* indicate mandatory attributes):

name* (string)
the name of the resource;
url* (string)
url of resource;
package_id* (string)
id of the item that the resource should be added to;
revision_id (string)
description (string)
a description for the resource;
format (string)
mimetype (string)
resource mimetype;
created (iso date string)
resource creation time;
last_modified (iso date string)
resource last update time;

Request Parameters
name type description
Authorization header Bearer token, see https://dev.d4science.org/how-to-access-resources
ITEM_ID path
Request Body
media type data type
application/json;charset=UTF-8 string
Response Body
media type data type description
application/json;charset=UTF-8 object

Example

Request
POST /items/{ITEM_ID}/resources
Content-Type: application/json;charset=UTF-8
Accept: application/json;charset=UTF-8
Authorization: ...

                
...
                
              
Response
HTTP/1.1 201 Created
Content-Type: application/json;charset=UTF-8

                
...
                
              

DELETE /items/{ITEM_ID}/resources/{RESOURCE_ID}

Request Parameters
name type description
Authorization header Bearer token, see https://dev.d4science.org/how-to-access-resources
ITEM_ID path
RESOURCE_ID path
Response Body
media type data type description
*/* object

Example

Request
DELETE /items/{ITEM_ID}/resources/{RESOURCE_ID}
Content-Type: */*
Accept: */*
Authorization: ...

                
...
                
              
Response
HTTP/1.1 204 No Content
Content-Type: */*

                
...
                
              

GET /items/{ITEM_ID}/resources/{RESOURCE_ID}

Request Parameters
name type description
Authorization header Bearer token, see https://dev.d4science.org/how-to-access-resources
ITEM_ID path
RESOURCE_ID path
Response Body
media type data type description
application/json;charset=UTF-8 string

Example

Request
GET /items/{ITEM_ID}/resources/{RESOURCE_ID}
Content-Type: */*
Accept: application/json;charset=UTF-8
Authorization: ...

                
...
                
              
Response
HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8

                
...
                
              

PATCH /items/{ITEM_ID}/resources/{RESOURCE_ID}

Request Parameters
name type description
Authorization header Bearer token, see https://dev.d4science.org/how-to-access-resources
ITEM_ID path
RESOURCE_ID path
Request Body
media type data type
application/json;charset=UTF-8 string
Response Body
media type data type description
application/json;charset=UTF-8 string

Example

Request
PATCH /items/{ITEM_ID}/resources/{RESOURCE_ID}
Content-Type: application/json;charset=UTF-8
Accept: application/json;charset=UTF-8
Authorization: ...

                
...
                
              
Response
HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8

                
...
                
              

PUT /items/{ITEM_ID}/resources/{RESOURCE_ID}

Request Parameters
name type description
Authorization header Bearer token, see https://dev.d4science.org/how-to-access-resources
ITEM_ID path
RESOURCE_ID path
Request Body
media type data type
application/json;charset=UTF-8 string
Response Body
media type data type description
application/json;charset=UTF-8 string

Example

Request
PUT /items/{ITEM_ID}/resources/{RESOURCE_ID}
Content-Type: application/json;charset=UTF-8
Accept: application/json;charset=UTF-8
Authorization: ...

                
...
                
              
Response
HTTP/1.1 204 No Content
Content-Type: application/json;charset=UTF-8

                
...