Qbit REST API

RESTful API for Qbit mobile application

Base URI

http://xmpp.qbitapp.com/
Headers
Content-Type
string required
Example:
application/json
API Methods
Scheduled messages
PUT /qbits/{id}
DELETE /qbits/{id}
Add scheduled message
POST /qbits

To schedule a new message

Request headers

Content-Type
string required
Example:
application/json

Request body

string
Examples
{ "from_jid": "example@xmpp.qbitapp.com", "to_jid": "example@xmpp.qbitapp.com", "content": "json", "closed_at": "YYYY-MM-DD HH:MM:SS" }

Responses

201 Created

Message scheduled successfully

Edit scheduled message
PUT /qbits/{id}

Method to edit an scheduled message.

Path variables

id
string required

Scheduled message id (unique identifier)

Request headers

Content-Type
string required
Example:
application/json

Request body

string
Examples
{ "from_jid": "example@xmpp.qbitapp.com", "to_jid": "example@xmpp.qbitapp.com", "content": "json", "closed_at": "YYYY-MM-DD HH:MM:SS" }

Responses

200 OK

Scheduled message updated successfully

404 Not Found

Identifier not found

Delete scheduled message
DELETE /qbits/{id}

Method to delete an scheduled message.

Path variables

id
string required

Scheduled message id (unique identifier)

Responses

204 No Content

Then no exists

Posthumous messages
POST /posthumous
PUT /posthumous/{id}
DELETE /posthumous/{id}
POST /posthumous/trigger
Add posthumous message
POST /posthumous

To schedule a new posthumous message

Request headers

Content-Type
string required
Example:
application/json

Request body

string
Examples
{ "from_jid": "example@xmpp.qbitapp.com", "to_jid": "example@xmpp.qbitapp.com", "content": "json" }

Responses

201 Created

Posthumous created successfully

Edit posthumous message
PUT /posthumous/{id}

Method to edit an scheduled posthumous message.

Path variables

id
string required

Posthumous message id (unique identifier)

Request headers

Content-Type
string required
Example:
application/json

Request body

string
Examples
{ "from_jid": "example@xmpp.qbitapp.com", "to_jid": "example@xmpp.qbitapp.com", "content": "json" }

Responses

200 OK

Posthumous message updated successfully

404 404 Not Found

Identifier not found

Delete posthumous message
DELETE /posthumous/{id}

Method to delete an scheduled posthumous message.

Path variables

id
string required

Posthumous message id (unique identifier)

Responses

204 No Content

Then no exists

Verify someone's has died
POST /posthumous/trigger

Method to verify that someone's has died

Request headers

Content-Type
string required
Example:
application/json

Request body

string
Examples
{ "jid": "example@xmpp.qbitapp.com" }

Responses

202 Accepted

The verification was accepted

Users
POST /users
PUT /users/{mobile}
GET /users/{user_jid}/qbits
GET /users/{user_jid}/posthumous
GET /users/{user_jid}/rooms
Add user (register)
POST /users

Method to add a user (register)

Request headers

Content-Type
string required
Example:
application/json

Request body

The validationUrl, oauthString, and password will be provided by the Digits API. The password is the token of the oauthString.

string
Examples
{ "mobile": "999999999", "validationUrl": "https://api.digits.com/1.1/sdk/account.json", "password": "722345602118500353-pVKLiZol74gDSYtlyL0h1qXSl7jJaG8", "oauthString": "OAuth oauth_timestamp=\"1462530866\",oauth_version=\"1.0\",oauth_consumer_key=\"ufT44FUdToMF7qgX5AXdxzIz6\",oauth_signature=\"qgwsWFa93VEuSfwJWAHxZG%2Bi39U%3D\",oauth_token=\"722345602118500353-pVKLiZol74gDSYtlyL0h1qXSl7jJaG8\",oauth_nonce=\"A06A381A-6066-43D2-99E6-59900F5300A9\",oauth_signature_method=\"HMAC-SHA1\"" }

Responses

201 Created

When it is a new user (not exists previously)

Body
string
200 OK

When it is an existing user

Body
string
401 Unauthorized

When the Digits validation fails

Body
string
Edit user
PUT /users/{mobile}

Method to edit user info, for example to set a name, surname or birthday.

Path variables

mobile
string required

Mobile number (unique identifier)

Request headers

Content-Type
string required
Example:
application/json

Request body

The fields are optional

string
Examples
{ "name": "Perico", "surname": "De Los Palotes", "birthday": "1988-11-26 00:00:00" }

Responses

200 OK

Everything was right

404 Not Found

The mobile does not exists

Retrieve qbits
GET /users/{user_jid}/qbits

Method to get all the qbits scheduled by the given user

Path variables

user_jid
string required

Jabber ID of the user who has scheduled the given qbits

Responses

200 OK

Returns the list of the pending scheduled qbits, otherwise it returns an empty list

Retrieve posthumous
GET /users/{user_jid}/posthumous

Method to get all the posthumous messages scheduled by the given user

Path variables

user_jid
string required

Jabber ID of the user who has scheduled the given posthumous

Responses

200 OK

Returns the list of the scheduled posthumous, otherwise it returns an empty list

Retrieve user rooms
GET /users/{user_jid}/rooms

Method to get all the rooms the given user has joined.

Path variables

user_jid
string required

Jabber ID of the user who is in the given rooms

Responses

200 OK

Returns the list of the rooms that the user has joined

User rooms

Methods to manage the user rooms

POST /users/{user_jid}/rooms
DELETE /users/{user_jid}/rooms/{muc_jid}
Add user room
POST /users/{user_jid}/rooms

Method to add a new user room with the join timestamp.

Path variables

user_jid
string required

Jabber ID of the user who has joined the given room

Request headers

Content-Type
string required
Example:
application/json

Request body

string
Examples
{ "muc_jid": "example@conference.xmpp.qbitapp.com", "joined_at": "YYYY-MM-DD HH:MM:SS" }

Responses

201 Created

Everyhing was OK

Delete user room
DELETE /users/{user_jid}/rooms/{muc_jid}

Method to delete a user room

Path variables

user_jid
string required

Jabber ID of the user

muc_jid
string required

Jabber ID of the room

Responses

204 No Content

The given user room does not exist (deleted)

Confidence Contacts
PUT /users/{user_jid}/confidence-contacts
GET /users/{user_jid}/confidence-contacts
Update confidence contacts
PUT /users/{user_jid}/confidence-contacts

Method to update the confidence contacts of an user

Path variables

user_jid
string required

JID to update his/her confidence contacts

Request headers

Content-Type
string required
Example:
application/json

Request body

string
Examples
{ "contacts": ["jid1, jid2, jid3"] }
Get confidence contacts
GET /users/{user_jid}/confidence-contacts

Method to get the confidence contacts of an user

Path variables

user_jid
string required

JID to update his/her confidence contacts