Log in
Allows API clients to authenticate themselves.
Request:
POST /api/public/v1/login
{ usernameOrEmail: string, password: string }
usernameOrEmail identifies the user by either username or email address.
Together with password, this provides login credentials for the user on behalf of
which the API client subsequently acts.
Response:
{ payload: { token: string }, status: "success" }
The token string is a "bearer token" that must be included in the
HTTP Authorization header in subsequent API calls that require an
authenticated and authorized user.
Example: Successful log-in
$ http --body https://jadapi.jadbio.com/api/public/v1/login \
usernameOrEmail=johndoe \
password=secret
{
"payload": {
"token": "a_very_long_and_cryptic_string"
},
"status": "success"
}
Incorrect password
$ http --body https://jadapi.jadbio.com/api/public/v1/login \
usernameOrEmail=unknown \
password=wrong
{
"code": "auth-10-3",
"message": "Invalid credentials",
"status": "error"
}
Note
The examples in the rest of this document assume that the token has been saved
to the file ~/.jadtoken. API calls that require authorization can then be
invoked as follows:
$ http --body https://jadapi.jadbio.com/api/public/v1/some/endpoint \
"Authorization: Bearer $(cat ~/.jadtoken)" \
parameter1=value1 \
parameter2=value2
Note of appreciation to JADBio users
We constantly make changes in the software and do our best to update these materials, but you may notice some differences. We welcome your feedback on how to make this more useful for you and requests for future tutorials.