Account Service v0.7.0

Account Service v0.7.0

Scroll down for code samples, example requests and responses. Select a language for code samples from the tabs above or the mobile navigation menu.

Authentication

  • HTTP Authentication, scheme: bearer

Invitation

Invites a new user to a specific project

Code samples

URL obj = new URL("/account-service/invitations");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

POST /account-service/invitations

This operation invites a new user to a specific project. The platform sends an invitation email with an invitation link to the provided email address.

Body parameter

[
  {
    "email": "cubist@samsung.com",
    "roles": [
      "project_sample:research-assistant"
    ]
  }
]

Parameters

Name

In

Type

Required

Description

body

body

array[object]

true

none

Example responses

default Response

{
  "code": "string",
  "message": "string"
}

Responses

Status

Meaning

Description

Schema

200

OK

A new account has been created with the provided email.

None

default

Default

An unexpected error has occurred.

Inline

Response Schema

Status Code default

Name

Type

Required

Restrictions

Description

» code

string

true

none

none

» message

string

true

none

none

ResearchAssistant

Verifies the provided email and sends a reset password email

Code samples

URL obj = new URL("/account-service/user/password/forgot");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

POST /account-service/user/password/forgot

This operation accepts an email address. If the provided email address is registered, the server sends a password reset email. If not, it returns a 404 response.

Body parameter

{
  "email": "string"
}

Parameters

Name

In

Type

Required

Description

body

body

object

true

none

Responses

Status

Meaning

Description

Schema

200

OK

The operation was successful.

None

400

Bad Request

The provided email is malformed.

None

404

Not Found

The email is not registered.

None

Resets the password

Code samples

URL obj = new URL("/account-service/user/password/reset");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

POST /account-service/user/password/reset

This operation resets the user's password. The "profile" field is optional. If no value is set for this field, the server doesn't change the user's profile.

Body parameter

{
  "resetToken": "aadfad...badfdfad",
  "password": "string",
  "profile": {
    "name": "david.lee",
    "status": "active"
  }
}

Parameters

Name

In

Type

Required

Description

body

body

object

true

none

Example responses

200 Response

{
  "email": "cubist@samsung.com",
  "id": "7d08351b-85b6-488e-a8a2-b8653defb865",
  "jwt": "eyJhbGc...ssw5c",
  "refreshToken": "aadfad...badfdfad",
  "roles": [
    "project_sample:research-assistant"
  ],
  "profile": {
    "name": "david.lee",
    "status": "active"
  }
}

Responses

Status

Meaning

Description

Schema

200

OK

The operation was successful.

Inline

default

Default

An unexpected error has occurred.

Inline

Response Schema

Status Code 200

Name

Type

Required

Restrictions

Description

» email

string(email)

true

none

none

» id

string

true

none

none

» jwt

string

true

none

Signed Json Web Token payload is as below.
{
"email": "cubist@samsung.com",
"roles": ["study_1:study-creator", "study_2:research-assistant"],
"iss": "https://research-hub.io/",
"exp": 1660377937,
"iat": 1660291536
}

» refreshToken

string

true

none

none

» roles

[string]

true

none

none

» profile

object

true

none

Account information in JSON without pre-defined fields.

Status Code default

Name

Type

Required

Restrictions

Description

» code

string

true

none

none

» message

string

true

none

none

Signs in a user with an email and password

Code samples

URL obj = new URL("/account-service/signin");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

POST /account-service/signin

Body parameter

{
  "email": "cubist@samsung.com",
  "password": "string"
}

Parameters

Name

In

Type

Required

Description

body

body

object

true

none

Example responses

200 Response

{
  "email": "cubist@samsung.com",
  "id": "7d08351b-85b6-488e-a8a2-b8653defb865",
  "jwt": "eyJhbGc...ssw5c",
  "refreshToken": "aadfad...badfdfad",
  "roles": [
    "project_sample:research-assistant"
  ],
  "profile": {
    "name": "david.lee",
    "status": "active"
  }
}

Responses

Status

Meaning

Description

Schema

200

OK

The operation was successful.

Inline

default

Default

An unexpected error has occurred.

Inline

Response Schema

Status Code 200

Name

Type

Required

Restrictions

Description

» email

string(email)

true

none

none

» id

string

true

none

none

» jwt

string

true

none

Signed Json Web Token payload is as below.
{
"email": "cubist@samsung.com",
"roles": ["study_1:study-creator", "study_2:research-assistant"],
"iss": "https://research-hub.io/",
"exp": 1660377937,
"iat": 1660291536
}

» refreshToken

string

true

none

none

» roles

[string]

true

none

none

» profile

object

true

none

Account information in JSON without pre-defined fields.

Status Code default

Name

Type

Required

Restrictions

Description

» code

string

true

none

none

» message

string

true

none

none

Signs up a new user

Code samples

URL obj = new URL("/account-service/signup");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

POST /account-service/signup

This operation signs up a new user. Afterwards, the server sends a verification link to the provided email address.

Body parameter

{
  "email": "cubist@samsung.com",
  "password": "string",
  "profile": {
    "name": "david.lee",
    "status": "active"
  }
}

Parameters

Name

In

Type

Required

Description

body

body

object

true

none

Example responses

default Response

{
  "code": "string",
  "message": "string"
}

Responses

Status

Meaning

Description

Schema

200

OK

A new account has been created.

None

409

Conflict

The provided email is already registered.

None

default

Default

An unexpected error has occurred.

Inline

Response Schema

Status Code default

Name

Type

Required

Restrictions

Description

» code

string

true

none

none

» message

string

true

none

none

Refreshes the access token

Code samples

URL obj = new URL("/account-service/token/refresh");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

POST /account-service/token/refresh

This operation requests a new token by sending a pair of JWT (accessToken) and refreshToken.

Body parameter

{
  "jwt": "eyJhbGc...ssw5c",
  "refreshToken": "aadfad...badfdfad"
}

Parameters

Name

In

Type

Required

Description

body

body

object

true

none

Example responses

200 Response

{
  "jwt": "eyJhbGc...ssw5c",
  "refreshToken": "aadfad...badfdfad"
}

Responses

Status

Meaning

Description

Schema

200

OK

The operation was successful.

Inline

default

Default

An unexpected error has occurred.

Inline

Response Schema

Status Code 200

Name

Type

Required

Restrictions

Description

» jwt

string

true

none

Signed Json Web Token payload is as below.
{
"email": "cubist@samsung.com",
"roles": ["study_1:study-creator", "study_2:research-assistant"],
"iss": "https://research-hub.io/",
"exp": 1660377937,
"iat": 1660291536
}

» refreshToken

string

true

none

none

Status Code default

Name

Type

Required

Restrictions

Description

» code

string

true

none

none

» message

string

true

none

none

Role

Assigns roles to a user

Code samples

URL obj = new URL("/account-service/user/roles");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("PUT");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

PUT /account-service/user/roles

Body parameter

{
  "accountId": "7d08351b-85b6-488e-a8a2-b8653defb865",
  "roles": [
    "project_sample:research-assistant"
  ]
}

Parameters

Name

In

Type

Required

Description

body

body

object

true

none

Example responses

default Response

{
  "code": "string",
  "message": "string"
}

Responses

Status

Meaning

Description

Schema

200

OK

The operation was successful.

None

default

Default

An unexpected error has occurred.

Inline

Response Schema

Status Code default

Name

Type

Required

Restrictions

Description

» code

string

true

none

none

» message

string

true

none

none

Removes roles from a user

Code samples

URL obj = new URL("/account-service/user/roles/remove");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

POST /account-service/user/roles/remove

Body parameter

{
  "accountId": "7d08351b-85b6-488e-a8a2-b8653defb865",
  "roles": [
    "project_sample:research-assistant"
  ]
}

Parameters

Name

In

Type

Required

Description

body

body

object

true

none

Example responses

default Response

{
  "code": "string",
  "message": "string"
}

Responses

Status

Meaning

Description

Schema

200

OK

The operation was successful.

None

default

Default

An unexpected error has occurred.

Inline

Response Schema

Status Code default

Name

Type

Required

Restrictions

Description

» code

string

true

none

none

» message

string

true

none

none

User

Retrieves a list of users

Code samples

URL obj = new URL("/account-service/users?projectId=100");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

GET /account-service/users

Parameters

Name

In

Type

Required

Description

projectId

query

string

true

The ID of the specific project for which to retrieve users

Example responses

200 Response

[
  {
    "email": "cubist@samsung.com",
    "id": "7d08351b-85b6-488e-a8a2-b8653defb865",
    "roles": [
      "project_sample:research-assistant"
    ],
    "profile": {
      "name": "david.lee",
      "status": "active"
    }
  }
]

Responses

Status

Meaning

Description

Schema

200

OK

The operation was successful.

Inline

default

Default

An unexpected error has occurred.

Inline

Response Schema

Status Code 200

Name

Type

Required

Restrictions

Description

» email

string(email)

true

none

none

» id

string

true

none

none

» roles

[string]

false

none

none

» profile

object

false

none

Account information in JSON without pre-defined fields.

Status Code default

Name

Type

Required

Restrictions

Description

» code

string

true

none

none

» message

string

true

none

none

Email Verification

Verifies the email with a token

Code samples

URL obj = new URL("/account-service/user/email/verify");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

POST /account-service/user/email/verify

Body parameter

{
  "token": "aadfad...badfdfad"
}

Parameters

Name

In

Type

Required

Description

body

body

object

true

none

Example responses

200 Response

{
  "email": "cubist@samsung.com",
  "id": "7d08351b-85b6-488e-a8a2-b8653defb865",
  "jwt": "eyJhbGc...ssw5c",
  "refreshToken": "aadfad...badfdfad",
  "roles": [
    "project_sample:research-assistant"
  ],
  "profile": {
    "name": "david.lee",
    "status": "active"
  }
}

Responses

Status

Meaning

Description

Schema

200

OK

The operation was successful.

Inline

401

Unauthorized

The token is invalid.

None

default

Default

An unexpected error has occurred.

Inline

Response Schema

Status Code 200

Name

Type

Required

Restrictions

Description

» email

string(email)

true

none

none

» id

string

true

none

none

» jwt

string

true

none

Signed Json Web Token payload is as below.
{
"email": "cubist@samsung.com",
"roles": ["study_1:study-creator", "study_2:research-assistant"],
"iss": "https://research-hub.io/",
"exp": 1660377937,
"iat": 1660291536
}

» refreshToken

string

true

none

none

» roles

[string]

true

none

none

» profile

object

true

none

Account information in JSON without pre-defined fields.

Status Code default

Name

Type

Required

Restrictions

Description

» code

string

true

none

none

» message

string

true

none

none

Resends a verification email

Code samples

URL obj = new URL("/account-service/verification");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

POST /account-service/verification

This operation resends a verification link to the provided email address.

Body parameter

{
  "email": "cubist@samsung.com"
}

Parameters

Name

In

Type

Required

Description

body

body

object

true

none

Example responses

500 Response

{
  "code": "string",
  "message": "string"
}

Responses

Status

Meaning

Description

Schema

200

OK

The operation was successful.

None

400

Bad Request

The request is bad.

None

409

Conflict

The email has already been verified.

None

500

Internal Server Error

An unexpected error has occurred.

Inline

Response Schema

Status Code 500

Name

Type

Required

Restrictions

Description

» code

string

true

none

none

» message

string

true

none

none

Schemas

InvitationReq




[
  {
    "email": "cubist@samsung.com",
    "roles": [
      "project_sample:research-assistant"
    ]
  }
]

Properties

Name

Type

Required

Restrictions

Description

email

string(email)

true

none

none

roles

[string]

true

none

none

Invitation




{
  "email": "cubist@samsung.com",
  "roles": [
    "project_sample:research-assistant"
  ]
}

Properties

Name

Type

Required

Restrictions

Description

email

string(email)

true

none

none

roles

[string]

true

none

none

Roles




[
  "project_sample:research-assistant"
]

Properties

None

Role




"project_sample:research-assistant"

A role is either system role or project role.
Researchers must have project roles to access specific project.

  • The format of project role is as follow: $project_id:$role_name

Properties

Name

Type

Required

Restrictions

Description

anonymous

string

false

none

A role is either system role or project role.
Researchers must have project roles to access specific project.
- The format of project role is as follow: $project_id:$role_name

ForgotPasswordReq




{
  "email": "string"
}

Properties

Name

Type

Required

Restrictions

Description

email

string

true

none

none

ResetPasswordReq




{
  "resetToken": "aadfad...badfdfad",
  "password": "string",
  "profile": {
    "name": "david.lee",
    "status": "active"
  }
}

Properties

Name

Type

Required

Restrictions

Description

resetToken

string

true

none

none

password

string

true

none

none

profile

object

false

none

Account information in JSON without pre-defined fields.

ResetPasswordResponse




{
  "email": "cubist@samsung.com",
  "id": "7d08351b-85b6-488e-a8a2-b8653defb865",
  "jwt": "eyJhbGc...ssw5c",
  "refreshToken": "aadfad...badfdfad",
  "roles": [
    "project_sample:research-assistant"
  ],
  "profile": {
    "name": "david.lee",
    "status": "active"
  }
}

Properties

Name

Type

Required

Restrictions

Description

email

string(email)

true

none

none

id

string

true

none

none

jwt

string

true

none

Signed Json Web Token payload is as below.
{
"email": "cubist@samsung.com",
"roles": ["study_1:study-creator", "study_2:research-assistant"],
"iss": "https://research-hub.io/",
"exp": 1660377937,
"iat": 1660291536
}

refreshToken

string

true

none

none

roles

[string]

true

none

none

profile

object

true

none

Account information in JSON without pre-defined fields.

SignInReq




{
  "email": "cubist@samsung.com",
  "password": "string"
}

Properties

Name

Type

Required

Restrictions

Description

email

string(email)

true

none

none

password

string

true

none

none

SignInResponse




{
  "email": "cubist@samsung.com",
  "id": "7d08351b-85b6-488e-a8a2-b8653defb865",
  "jwt": "eyJhbGc...ssw5c",
  "refreshToken": "aadfad...badfdfad",
  "roles": [
    "project_sample:research-assistant"
  ],
  "profile": {
    "name": "david.lee",
    "status": "active"
  }
}

Properties

Name

Type

Required

Restrictions

Description

email

string(email)

true

none

none

id

string

true

none

none

jwt

string

true

none

Signed Json Web Token payload is as below.
{
"email": "cubist@samsung.com",
"roles": ["study_1:study-creator", "study_2:research-assistant"],
"iss": "https://research-hub.io/",
"exp": 1660377937,
"iat": 1660291536
}

refreshToken

string

true

none

none

roles

[string]

true

none

none

profile

object

true

none

Account information in JSON without pre-defined fields.

SignUpReq




{
  "email": "cubist@samsung.com",
  "password": "string",
  "profile": {
    "name": "david.lee",
    "status": "active"
  }
}

Properties

Name

Type

Required

Restrictions

Description

email

string(email)

true

none

none

password

string

true

none

none

profile

object

true

none

Account information in JSON without pre-defined fields.

RoleReq




{
  "accountId": "7d08351b-85b6-488e-a8a2-b8653defb865",
  "roles": [
    "project_sample:research-assistant"
  ]
}

Properties

Name

Type

Required

Restrictions

Description

accountId

string

true

none

none

roles

[string]

true

none

none

RefreshReq




{
  "jwt": "eyJhbGc...ssw5c",
  "refreshToken": "aadfad...badfdfad"
}

Properties

Name

Type

Required

Restrictions

Description

jwt

string

true

none

Signed Json Web Token payload is as below.
{
"email": "cubist@samsung.com",
"roles": ["study_1:study-creator", "study_2:research-assistant"],
"iss": "https://research-hub.io/",
"exp": 1660377937,
"iat": 1660291536
}

refreshToken

string

true

none

none

RefreshResponse




{
  "jwt": "eyJhbGc...ssw5c",
  "refreshToken": "aadfad...badfdfad"
}

Properties

Name

Type

Required

Restrictions

Description

jwt

string

true

none

Signed Json Web Token payload is as below.
{
"email": "cubist@samsung.com",
"roles": ["study_1:study-creator", "study_2:research-assistant"],
"iss": "https://research-hub.io/",
"exp": 1660377937,
"iat": 1660291536
}

refreshToken

string

true

none

none

VerifyEmailReq




{
  "token": "aadfad...badfdfad"
}

Properties

Name

Type

Required

Restrictions

Description

token

string

true

none

none

VerifyEmailResponse




{
  "email": "cubist@samsung.com",
  "id": "7d08351b-85b6-488e-a8a2-b8653defb865",
  "jwt": "eyJhbGc...ssw5c",
  "refreshToken": "aadfad...badfdfad",
  "roles": [
    "project_sample:research-assistant"
  ],
  "profile": {
    "name": "david.lee",
    "status": "active"
  }
}

Properties

Name

Type

Required

Restrictions

Description

email

string(email)

true

none

none

id

string

true

none

none

jwt

string

true

none

Signed Json Web Token payload is as below.
{
"email": "cubist@samsung.com",
"roles": ["study_1:study-creator", "study_2:research-assistant"],
"iss": "https://research-hub.io/",
"exp": 1660377937,
"iat": 1660291536
}

refreshToken

string

true

none

none

roles

[string]

true

none

none

profile

object

true

none

Account information in JSON without pre-defined fields.

VerificationReq




{
  "email": "cubist@samsung.com"
}

Properties

Name

Type

Required

Restrictions

Description

email

string(email)

true

none

none

Users




[
  {
    "email": "cubist@samsung.com",
    "id": "7d08351b-85b6-488e-a8a2-b8653defb865",
    "roles": [
      "project_sample:research-assistant"
    ],
    "profile": {
      "name": "david.lee",
      "status": "active"
    }
  }
]

Properties

Name

Type

Required

Restrictions

Description

email

string(email)

true

none

none

id

string

true

none

none

roles

[string]

false

none

none

profile

object

false

none

Account information in JSON without pre-defined fields.

User




{
  "email": "cubist@samsung.com",
  "id": "7d08351b-85b6-488e-a8a2-b8653defb865",
  "roles": [
    "project_sample:research-assistant"
  ],
  "profile": {
    "name": "david.lee",
    "status": "active"
  }
}

Properties

Name

Type

Required

Restrictions

Description

email

string(email)

true

none

none

id

string

true

none

none

roles

[string]

false

none

none

profile

object

false

none

Account information in JSON without pre-defined fields.

Profile




{
  "name": "david.lee",
  "status": "active"
}

Account information in JSON without pre-defined fields.

Properties

None

Token




"eyJhbGc...ssw5c"

Signed Json Web Token payload is as below.
{
"email": "cubist@samsung.com",
"roles": ["study_1:study-creator", "study_2:research-assistant"],
"iss": "https://research-hub.io/",
"exp": 1660377937,
"iat": 1660291536
}

Properties

Name

Type

Required

Restrictions

Description

anonymous

string

false

none

Signed Json Web Token payload is as below.
{
"email": "cubist@samsung.com",
"roles": ["study_1:study-creator", "study_2:research-assistant"],
"iss": "https://research-hub.io/",
"exp": 1660377937,
"iat": 1660291536
}

Email




"cubist@samsung.com"

Properties

Name

Type

Required

Restrictions

Description

anonymous

string(email)

false

none

none

AccountId




"7d08351b-85b6-488e-a8a2-b8653defb865"

Properties

Name

Type

Required

Restrictions

Description

anonymous

string

false

none

none

ProjectId




100

Properties

Name

Type

Required

Restrictions

Description

anonymous

string

false

none

none

ResetToken




"aadfad...badfdfad"

Properties

Name

Type

Required

Restrictions

Description

anonymous

string

false

none

none

RefreshToken




"aadfad...badfdfad"

Properties

Name

Type

Required

Restrictions

Description

anonymous

string

false

none

none

VerifyEmailToken




"aadfad...badfdfad"

Properties

Name

Type

Required

Restrictions

Description

anonymous

string

false

none

none

Error




{
  "code": "string",
  "message": "string"
}

Properties

Name

Type

Required

Restrictions

Description

code

string

true

none

none

message

string

true

none

none