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:
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
Headers: X-BB-SESSION: The Session Token
- X-BB-SESSION must contain the session token provided by the login API
Description: This API allows a user to logout from the App
Returns:
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:
Not yet implemented GET /user/:username/exists
Headers: See the General Remarks
Returns:
GET /me
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 /me
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 /me/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:
POST /follow/:username
Headers: See authorization header in the General Remarks
Description: This API allows a user to create a friendship relationship with another user whose username is the one specified in the :username URL component. Once the friendship relation has been created, the follower will be able to see the documents created by the followed user as well as its visibleByFriends data in its user profile
Returns:
DELETE /follow/:username
Headers: See authorization header in the General Remarks
Description: This API allows a user to delete a friendship relationship with another user whose username is the one specified in the :username URL component.Once the friendship relation has been deleted the follower will not be able to see the documents created by the followed user as well as its visibleByFriends data in its user profile.
Returns:
GET /following
Headers: See authorization header in the General Remarks
Description: This API returns a list of users that are followed by the current one (the one that made the call). The method returns in its data property an array filled with the user profiles representing its “friends”. Each profile will contain the visibleByFriends data which would be otherwise protected.
Returns:
Returns an empty collection instead of error 404 if elements not exist.
GET /following/:username
Headers: See authorization header in the General Remarks
Parameters
Description: This API returns a list of users that are followed by the user passed in parameter. In its data property the method returns an array filled with the user profiles representing its friends. Each profile will contain the visibleByFriends data, which would be otherwise protected.
Returns:
Returns an empty collection instead of error 404 if elements do not exist.
GET /followers
Headers: See authorization header in the General Remarks
Description: This API returns the list of followers. The method returns in its data property an array filled with the user profiles representing its “friends”. Each profile will contain the visibleByFriends data which would be otherwise protected. This API supports filter criteria, sorting, pagination
Returns:
GET /followers/:username
Headers: See authorization header in the General Remarks
Parameters
Description: This API returns the list of followers by the username passed in parameter. In its data property the method returns an array filled with the user profiles representing its friends. Each profile will contain the visibleByFriends data which would be otherwise protected. This API supports filter criteria, sorting, pagination
Returns:
Click here for the Social Login section