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

Users Resource

REST interface for the social networking library (users).

GET /2/users/get-all-fullnames-and-usernames

Get the map of couples username/fullname of the users belonging to a given context

Request Parameters
name type description
Authorization header Bearer token, see https://dev.d4science.org/how-to-access-resources
Content-Type header application/json
Response Codes
code condition
200 The map is put into the 'result' field of the returned object
500 The error is reported into the 'message' field of the returned object
Response Body
media type data type description
application/json object (JSON) the map of couples username/fullname of the users belonging to the context linked to the provided token.

Example

Request
GET /2/users/get-all-fullnames-and-usernames
Content-Type: */*
Accept: application/json
Authorization: ...

                
...
                
              
Response
HTTP/1.1 200 OK
Content-Type: application/json

                
...
                
              

GET /2/users/get-all-usernames

Request Parameters
name type description
Authorization header Bearer token, see https://dev.d4science.org/how-to-access-resources
Content-Type header application/json
Response Codes
code condition
200 The list of usernames is put into the 'result' field of the returned object
500 The error is reported into the 'message' field of the returned object
Response Body
media type data type description
application/json object (JSON) the list of usernames for the user belonging to the context linked to the provided auth token

Example

Request
GET /2/users/get-all-usernames
Content-Type: */*
Accept: application/json
Authorization: ...

                
...
                
              
Response
HTTP/1.1 200 OK
Content-Type: application/json

                
{
  "success" : true,
  "message" : null,
  "result" : [ "john.smith", "marco.polo" ]
}
                
              

GET /2/users/get-custom-attribute

Request Parameters
name type description constraints
Authorization header Bearer token, see https://dev.d4science.org/how-to-access-resources  
Content-Type header application/json  
attribute query required
Response Codes
code condition
200 Successful read of the attribute, reported in the 'result' field of the returned object
404 Such an attribute doesn't exist
500 The error is reported into the 'message' field of the returned object
Response Body
media type data type description
application/json object (JSON)

Example

Request
GET /2/users/get-custom-attribute
Content-Type: */*
Accept: application/json
Authorization: ...

                
...
                
              
Response
HTTP/1.1 200 OK
Content-Type: application/json

                
...
                
              

GET /2/users/get-email

Request Parameters
name type description
Authorization header Bearer token, see https://dev.d4science.org/how-to-access-resources
Content-Type header application/json
Response Codes
code condition
200 The user's email is reported in the 'result' field of the returned object
500 The error is reported into the 'message' field of the returned object
Response Body
media type data type description
application/json object (JSON)

Example

Request
GET /2/users/get-email
Content-Type: */*
Accept: application/json
Authorization: ...

                
...
                
              
Response
HTTP/1.1 200 OK
Content-Type: application/json

                
...
                
              

GET /2/users/get-fullname

Request Parameters
name type description
Authorization header Bearer token, see https://dev.d4science.org/how-to-access-resources
Content-Type header application/json
Response Codes
code condition
200 The user's fullname is reported in the 'result' field of the returned object
500 The error is reported into the 'message' field of the returned object
Response Body
media type data type description
application/json object (JSON)

Example

Request
GET /2/users/get-fullname
Content-Type: */*
Accept: application/json
Authorization: ...

                
...
                
              
Response
HTTP/1.1 200 OK
Content-Type: application/json

                
...
                
              

GET /2/users/get-oauth-profile

Request Parameters
name type description
Authorization header Bearer token, see https://dev.d4science.org/how-to-access-resources
Content-Type header application/json
Response Body
media type data type description
application/json object (JSON) the user's profile compliant with oauth

Example

Request
GET /2/users/get-oauth-profile
Content-Type: */*
Accept: application/json
Authorization: ...

                
...
                
              
Response
HTTP/1.1 200 OK
Content-Type: application/json

                
{
  "id" : "john.smith",
  "roles" : [ ],
  "picture" : "https://***gAJ4uVWTA74xwQ6%2FCA72RRinysY%3D",
  "name" : "John Smith",
  "middle_name" : "",
  "male" : true,
  "location_industry" : "no",
  "given_name" : "John",
  "email" : "******",
  "job_title" : "",
  "family_name" : "Smith",
  "verified_email" : true
}
                
              

GET /2/users/get-profile

Get the profile associated to the token

Request Parameters
name type description
Authorization header Bearer token, see https://dev.d4science.org/how-to-access-resources
Content-Type header application/json
Response Codes
code condition
200 The user's profile is reported in the 'result' field of the returned object
500 The error is reported into the 'message' field of the returned object
Response Body
media type data type description
application/json object (JSON) the user's profile. The user is the one owning the token

Example

Request
GET /2/users/get-profile
Content-Type: */*
Accept: application/json
Authorization: ...

                
...
                
              
Response
HTTP/1.1 200 OK
Content-Type: application/json

                
{
  "success" : true,
  "message" : null,
  "result" : {
    "user_id" : 23769487,
    "username" : "john.smith",
    "email" : "********",
    "first_name" : "John",
    "middle_name" : "",
    "last_name" : "Smith",
    "fullname" : "John Smith",
    "registration_date" : 1475151491415,
    "user_avatar_url" : "https://******D",
    "male" : true,
    "job_title" : "",
    "location_industry" : "no",
    "custom_attrs_map" : null,
    "email_addresses" : [ ],
    "screen_name" : "john.smith",
    "user_avatar_id" : "https://****sY%3D"
  }
}
                
              

GET /2/users/get-usernames-by-global-role

Get the list of users having a given global-role, e.g. 'Administrator'. (Legacy)

Request Parameters
name type description
Authorization header Bearer token, see https://dev.d4science.org/how-to-access-resources
Content-Type header application/json
role-name query the name of the role to be checked (e.g. Administrator)
Response Codes
code condition
200 The list is put into the 'result' field of the returned object
500 The error is reported into the 'message' field of the returned object
Response Body
media type data type description
application/json object (JSON) the list of users having a given global-role

Example

Request
GET /2/users/get-usernames-by-global-role
Content-Type: */*
Accept: application/json
Authorization: ...

                
...
                
              
Response
HTTP/1.1 200 OK
Content-Type: application/json

                
...
                
              

GET /2/users/get-usernames-by-role

Request Parameters
name type description
Authorization header Bearer token, see https://dev.d4science.org/how-to-access-resources
Content-Type header application/json
role-name query the role name
Response Body
media type data type description
application/json object (JSON) the usernames having the role in the VRE

Example

Request
GET /get-usernames-by-role?role-name=VRE-Manager
Content-Type: */*
Accept: application/json
Authorization: ...

                
...
                
              
Response
HTTP/1.1 200 OK
Content-Type: application/json

                
{
  "success" : true,
  "message" : null,
  "result" : [ "john.smith", "marco.polo" ]
}
                
              

GET /2/users/user-exists

This method has been deprecated.

Request Parameters
name type description
Authorization header Bearer token, see https://dev.d4science.org/how-to-access-resources
Content-Type header application/json
username query
Response Body
media type data type description
application/json object (JSON)

Example

Request
GET /2/users/user-exists
Content-Type: */*
Accept: application/json
Authorization: ...

                
...
                
              
Response
HTTP/1.1 200 OK
Content-Type: application/json

                
...