POST /user
Headers: See authorization header in the General Remarks
Description: This API allows a user to sign up to the App. Users will belong to the registereduser role and they will post new content, will retrieve their own content, will change their password.
Body payload A JSON object like this:
{
"username":"{username}",
"password":"{password}",
"visibleByTheUser": {...},
"visibleByFriend": {...},
"visibleByRegisteredUsers": {..},
"visibleByAnonymousUsers": {...}
}
Returns:
Username and password are mandatory.
POST /login
Headers: Content-Type: application/x-www-form-urlencoded
Description: Checks username/password and grants the user the right
to execute other calls. This API returns a session token that must be provided into subsequent calls.
Body payload
username={username}&password={password}&appcode={appcode}&login_data={“os”:”{ios|android}”, “deviceId”:”{……..}”}
Example of valid login_data content is:
{
"os":"android",
"deviceId":"xxxxxxxxxxxxxx"
}
Note that in this way a user could login from different devices at the same time.
Returns:
{
"result": "ok",
"http_code": 200,
"data": {
"X-BB-SESSION": "9b3c7234-e0eb-4861-8a25-6874d232efd0"
}
}
Note that if not used the token will expire in 15 minutes. In that case a new login must be performed. The token expiration does not delete the device ID info so the user may continue to receive push notifications.
POST /logout/:deviceId
Headers: X-BB-SESSION: The Session Token
- X-BB-SESSION must contain the session token provided by the login API
Parameters
- deviceId: the deviceId used in the login API
Description: This API allows a user to logout from the App on a specific device. Push notification will not be sent to the user through the specified device.
Returns:
GET /user/:username/password/reset
Headers: X-BAASBOX-APPCODE: The App Code
Parameters
Description: Allows to reset a user password. This API is useful when a user forgot their password and needs to reset it. In order to work, this function needs an email field to be present with a valid email addressthat in the visibleByTheUser field of the user profile. This is the workflow of this function: A user needs to reset their forgotten password. The App must call the /user/:username/password/reset API where :username is the placeholder to substitute with the username. The server checks if the email address is present within the visibleByTheUser fields in the user profile The server sends an email to that address with a generated link to follow to reset the password The user opens the email and opens the given link in a web browser A form is shown with two html password fields. The user fills in the two fields and submits the form A confirmation message is shown by the server Many settings can be setup by the administrator via the Settings menu in the admin console, or via the Settings API Some of them are: The SMTP Server configuration The email message to be sent The HTML Form to show in order to reset the password The confirmation and the error web page
Returns:
GET /user
Headers: See the General Remarks for authentication hints.
Description: Retrieves the information about the user. Specifically the following JSON is returned:
{
"visibleByTheUser": {...},
"visibleByFriend": {...},
"visibleByRegisteredUsers": {...},
"visibleByAnonymousUsers": {...}
}
Returns:
PUT /user
Headers: See the General Remarks
Body payload A JSON object like this:
{
"visibleByTheUser": {...},
"visibleByFriend": {...},
"visibleByRegisteredUsers": {..},
"visibleByAnonymousUsers": {...}
}
Description: Update an user profile information.
The four JSON objects are optional. Using this API you can send just one of them or all four.
PAY ATTENTION: The previously stored content for each of the JSON objects will be overwritten with what was sent through this API.
Returns:
PUT /user/password
Headers: See the General Remarks
Body payload A JSON object like this:
{
"old": "the old password",
"new": "the new password"
}
both old and new fields are mandatory. Description: Changes the password of a user. Returns:
Not yet implemented GET /user/:username/exists
Headers: See the General Remarks
Returns: