SDK Methods

Create Ticket

This method lets you create a ticket.

Usage

client.createTicket(data).then(function(result){ 

});
 

Data

The input parameter of the method. It has the following structure:

var data = {
    // The title of the ticket
    title: string,

    creator: {
        // The name of the user (required)
        name: string,

        // The address of the user (required)
        address: string,

        // A list of user extra data values
        extra: [
            {
                id: integer,
                content: string
            }
        ]
    },

    // The body of the ticket. Accepts an HTML formatted string and inline atachments (required)
    message: string,

    // A list of media ids
    attachments: [ integer ],

    // A list of classification ids
    classifications: [ integer ],

    // A list of ticket extra data values
    extra: [
        {
            id: integer,
            content: string
        }
    ],

    // The id of a custom ticket source
    source: integer,

    // The id of the ticket language
    language: integer,

    /**
     * The priority of the ticket
     * - 1: Low
     * - 2: Meduim
     * - 3: High
     */
    priority: integer,

    // The queue of the ticket.
    queue: integer,
}

Response

{
    uuid: integer
}

Example

client.createTicket({
creator: {
    address:'<email_address>',
    extra:[],
    name:'<name>'
},       
message:'<message>'
}).then(function(result){
console.log(result);
});

Create User

This method lets you create a user.

Usage

client.createUser(data).then(function(result){ 

});

Data

The input parameter of the method. It has the following structure:

var data = {
    // The name of the user (required)
    name: string,

    // The address of the user (required)
    address: string,

    // A list of user extra data values
    extra: [
        {
            id: integer,
            content: string
        }
    ]
} 

Response

{
    uuid: integer
}

Example

client.createUser({
    address:'<email_address>',
    extra:[],
    name:'<name>'
}).then(function(result){
console.log(result);
});

Get All Users

This method lets you get a list of users, filtered or not.

Usage

client.getAllUsers(filters).then(function(result){

});

Filters

The input parameter of the method. It has the following structure:

var filters = {

    // The name of the user
    name: string,

    // The address of the user
    address: string,

    // Whether the returned users are agents or not
    agent: boolean,

    // The page of results that will get returned. Has to be equal or greater than 1
    page: integer,

    // The amount of items returned on each page. Has to be equal or greater than 1
    items: integer

} 

Response

{
    per_page: integer,
    current_page: integer,
    from: integer,
    to: integer,
    total: integer,
    data: [
        {
            id: integer,
            name: string,
            address: string,
            extra: [
                {
                    id: integer,
                    name: string,
                    content: string
                }
            ],
            is_agent: boolean
        }
    ]
}

Example

client.getAllUsers().then(function(result){
console.log(result);
});

client.getAllUsers({
    address: '<email_address>',
    page: <page_number>,
    items: <total_items>
}).then(function(result){
console.log(result);
});