REST API & Apps

Apps

Apps in the system were designed to provide a REST API to your system, you can create multiple application, limit application to (read/edit/create/delete/or full info) and monitor all requests to the application.

To create a new application, head to ( Apps => Create New Application ) in your admin panel :

There , you can give your program a title and permissions





Then, copy your Secret to a safe place, that's what you will be using to authenticate



Go to Settings => General Settings => API. You will find settings to set the method of authentication and Response type

If you've chosen Header as type of authentication, you will need to add this header in your requests:

/* Change the secret code to whatever your app secret is*/
FC-Secret: uFWijNxl2zIcdBMT7Xq5tdM4pvtBMPsONJWJ2rDU1ps4mSw7buAv38Me7aHJJ7EH
 

If your're using Input as a , send it as a field named "FC-Secret" with value of your secret

As for response , you can choose between:

- JSON
- XML
- YAML
- CSV

This will be the default response type, or you can add ".xml" etcetera to the end of your request , Example"

// If the default response is JSON
response = 'http://support.example.com/api/user/show/1' // returns JSON
response2 = 'http://support.example.com/api/user/show/1.xml' // returns XML

As for possible requests type, here is a list p of and required permissions:

The base URL will be yoursite.com/api/

                                                                                                                                 
Request Type Input Description Permission Needed
Users
user/show/{id}GET-Show user information READ
user/search/{term}GET-Search in name and emails, returns 50 items maximum READ
user/onlineGET-Get all online users, ordered by last_seen. returns 50 items maximum READ
user/onlinestaffGET-Get all online staff, ordered by last_seen. returns 50 items maximum READ
user/addPOSTemail,password,name,verification,type,departmentAdd new user, and return created user information with user id WRITE
user/deactivate/{id}POST-Deactivates a user DELETE
Tickets
ticket/show/{id}GET-Show ticket information READ
ticket/user/{id}GETstart=0Show tickets of a user. Skipping the start value READ
ticket/messages/{ticket_id}GETstart=0Show replies of a ticket, including notes skipping the start value ( to paginate ) READ
ticket/history/{ticket_id}GETstart=0Retrieve history of the ticket. Skipping the start value READ
ticket/search/{term}GETstart=0Search in ticket title and messages. Skipping the start value READ
ticket/addPOSTtitle,user_id,department,status,priority,assigned_to=autoAdds new ticket and return created ticket information WRITE
ticket/updatePOSTtitle,user_id,department,status,priority,assigned_toUpdate a ticket and return updated ticket information EDIT
ticket/add-message/{ticket_id}POSTuser_id,contentAdd a message reply to the ticket and return message information WRITE
ticket/update-message/{message_id}POSTuser_id,contentUpdate a message reply and return updated message information EDIT
ticket/delete/{ticket_id}POST-Deletes the ticket DELETE
Live Chat
live/show/{conversation_id}GET-Get live conversation information READ
live/user/{id}GET-Get conversations of a user READ
live/messages/{conversation_id}GETstart=0Get messages of a conversation , skipping start value. READ
live/add/{conversation_id}POSTuser_id,contentAdds a message to a live conversation. WRITE
live/update/{conversation_id}POSTassigned_to,statusUpdates a conversation. EDIT
live/delete/{conversation_id}POST-Deletes a conversation. DELETE
Announcements
announcements/show/{announcement_id}GET-Get an announcement information READ
announcements/addPOSTtitle,content,user_id,publish_atAdds an announcement and return announcement information WRITE
announcements/update/{announcement_id}POSTtitle,content,user_idUpdate an announcement and return updated announcement information EDIT
announcements/delete/{announcement_id}POST-Deletes an announcement and return updated announcement information DELETE

Error codes

Example error response

{"status":"error","code":101}

All error codes and description:

               
CodeDescription
101 The secret was not found in the database or not associated with any application
102 Permissions error. You don't have permissions to do this action
103 Insecure request sent when SSL Use is enforced.  
201 Invalid information were submitted.