Ticket

A ticket holds information about an inquiry. A ticket is linked to messages which hold the conversation between merchant and customer.

Example Object

{
    "ticket": {
        "id": 2546,
        "createdAt": "2018-01-25T18:21:47+00:00",
        "updatedAt": "2018-01-25T18:21:47+00:00",
        "isAnswered": false,
        "isClosed": false,
        "isTodo": false,
        "subject": "test ticket",
        "memo": "",
        "doNotifyAnswered": false,
        "language": {
            "id": 18,
            "code": "us",
            "locale": "en_US",
            "title": "English (US)"
        },
        "customer": {
            "resource": {
                "id": 1118417,
                "url": "customers/1118417",
                "link": "https://api.shoplightspeed.com/us/customers/1118417.json"
            }
        },
        "messages": {
            "resource": {
                "id": false,
                "url": "tickets/2546/messages",
                "link": "https://api.shoplightspeed.com/us/tickets/2546/messages.json"
            }
        }
    }
}

Properties

id The unique numeric identifier for the ticket. {“id”: “{id}” }
createdAt The date and time when the ticket was created. (format: ISO-8601){“createdAt”: “2018-01-25T18:21:47+00:00”}
updatedAt The date and time when the ticket was last updated. (format: ISO-8601){“updatedAt”: “2018-01-25T18:21:47+00:00”}
isAnswered If the ticket has been answered (can be set manually). (format: boolean){“isAnswered”: “true|false”}
isClosed If the ticket is closed (can be set manually). (format: boolean){“isClosed”: “true|false”}
isTodo If the ticket has been turned into a todo. (format: boolean){“isTodo”: “true|false”}
subject The subject of a ticket. {“subject”: “subject”}
memo The internal memo. {“memo”: “memo”}
doNotifyAnswered If the customer should be notified of an answer. (format: boolean){“doNotifyAnswered”: “true|false”}
language The language object. {“language”: *{“id”: 1, “code”: “ca”, “locale”: “nl_NL”, “title”: “Nederlands”}
customer Link to Customer resource. {“customer”: “customers/{customer_id}
messages Link to TicketMessage resource. {“messages”: “tickets/{ticket_id}/messages”}

GET All tickets

Retrieve a list of all ticket objects from this shop.

Definition

GET /tickets.json

Example request

curl https://api.shoplightspeed.com/en/tickets.json \
  -u {key}:{secret}
<?php $api->tickets->get();

Example Response

{
    "tickets": [
        {
            "id": 2546,
            "createdAt": "2018-01-25T18:21:47+00:00",
            "updatedAt": "2018-01-25T18:21:47+00:00",
            "isAnswered": false,
            "isClosed": false,
            "isTodo": false,
            "subject": "test ticket",
            "memo": "",
            "doNotifyAnswered": false,
            "language": {
                "id": 18,
                "code": "us",
                "locale": "en_US",
                "title": "English (US)"
            },
            "customer": {
                "resource": {
                    "id": 1118417,
                    "url": "customers/1118417",
                    "link": "https://api.shoplightspeed.com/us/customers/1118417.json"
                }
            },
            "messages": {
                "resource": {
                    "id": false,
                    "url": "tickets/2546/messages",
                    "link": "https://api.shoplightspeed.com/us/tickets/2546/messages.json"
                }
            }
        }
    ]
}

Arguments

  No arguments available.

Filters

email Retrieve the tickets created by a specific email address.
limit Number of results. {(default: 50) (maximum: 250)}
page Page to show. {(default: 1)}
since_id Restrict results to after the specified ID. {(default: 0)}
created_at_min Show tickets created after date. {(format: YYYY-MM-DD HH:MM:SS)}
created_at_max Show tickets created before date. {(format: YYYY-MM-DD HH:MM:SS)}

GET Number of tickets

Retrieve the total number of ticket objects from this shop.

Example request

curl https://api.shoplightspeed.com/en/tickets/count.json \
  -u {key]:{secret}
<?php $api->tickets->count();

Example response

{
  "count": 1
}

Arguments

  No arguments available

Filters

limit Number of results. {(default: 50) (maximum: 250)}
page Page to show. {(default: 1)}
since_id Restrict results to after the specified ID. {(default: 0)}
created_at_min Show tickets created after date. {(format: YYYY-MM-DD HH:MM:SS)}
created_at_max Show tickets created before date. {(format: YYYY-MM-DD HH:MM:SS)}

GET Retrieve a ticket

Retrieve a single ticket based on the unique identifier.

Definition

GET /tickets/{ticket_id}.json

Example request

curl https://api.shoplightspeed.com/en/tickets/{ticket_id}.json \
  -u {key}:{secret}
<?php $api->tickets->get($ticket_id);

Example response

{
    "ticket": {
        "id": 2546,
        "createdAt": "2018-01-25T18:21:47+00:00",
        "updatedAt": "2018-01-25T18:21:47+00:00",
        "isAnswered": false,
        "isClosed": false,
        "isTodo": false,
        "subject": "test ticket",
        "memo": "",
        "doNotifyAnswered": false,
        "language": {
            "id": 18,
            "code": "us",
            "locale": "en_US",
            "title": "English (US)"
        },
        "customer": {
            "resource": {
                "id": 1118417,
                "url": "customers/1118417",
                "link": "https://api.shoplightspeed.com/us/customers/1118417.json"
            }
        },
        "messages": {
            "resource": {
                "id": false,
                "url": "tickets/2546/messages",
                "link": "https://api.shoplightspeed.com/us/tickets/2546/messages.json"
            }
        }
    }
}

Arguments

id The unique numeric identifier for the ticket. {“id”: {id}}

POST Create a ticket

Create a new ticket based on the given parameters.

Definition

POST /tickets.json

Example request

curl https://api.shoplightspeed.com/en/tickets.json \
  -u {key}:{secret} \
  -d ticket[subject]="Your order has a slight delay" \
  -d ticket[memo]="" \
  -d ticket[customer]=1 \
  -d ticket[isAnswered]="false" \
  -d ticket[isTodo]="false" \
  -d ticket[isClosed]="false"
<?php $api->ticket->create([
    "subject"    => "Your order has a slight delay",
    "memo"       => "",
    "customer"   => 1118417,
    "isAnswered" => "false",
    "isTodo"     => "false",
    "isClosed"   => "false"
]);

Example Json payload

{
  "ticket": {
    "subject": "Your order has a slight delay",
    "memo": "",
    "customer": 1118417,
    "isAnswered": false,
    "isTodo": false,
    "isClosed": false
  }
}

Example response

{
    "ticket": {
        "id": 8873,
        "createdAt": "2019-07-29T18:59:12+00:00",
        "updatedAt": "2019-07-29T18:59:12+00:00",
        "isAnswered": false,
        "isClosed": false,
        "isTodo": false,
        "subject": "Your order has a slight delay",
        "memo": "",
        "doNotifyAnswered": false,
        "language": {
            "id": 18,
            "code": "us",
            "locale": "en_US",
            "title": "English (US)"
        },
        "customer": {
            "resource": {
                "id": 1118417,
                "url": "customers/1118417",
                "link": "https://api.shoplightspeed.com/us/customers/1118417.json"
            }
        },
        "messages": {
            "resource": {
                "id": false,
                "url": "tickets/8873/messages",
                "link": "https://api.shoplightspeed.com/us/tickets/8873/messages.json"
            }
        }
    }
}

Arguments

isAnswered If the ticket has been answered (can be set manually). (format: boolean){“isAnswered”: “true|false”}
isClosed If the ticket is closed (can be set manually). (format: boolean){“isClosed”: “true|false”}
isTodo If the ticket has been turned into a todo. (format: boolean){“isTodo”: “true|false”}
subject The subject of a ticket. {“subject”: “subject”}
memo The internal memo. {“memo”: “memo”}
doNotifyAnswered If the customer should be notified of an answer. (format: boolean){“doNotifyAnswered”: “true|false”}
customer Link to Customer resource. {“customer”: “customers/{customer_id}

PUT Update a ticket

Update an existing ticket based on the given parameters.

Definition

PUT /tickets/{ticket_id}.json

Example request

curl https://api.shoplightspeed.com/en/tickets/{ticket_id}.json \
  -u {key}:{secret} \
  -X PUT
  -d ticket[subject]="Your order has a slight delay" \
  -d ticket[memo]="" \
  -d ticket[isAnswered]="false" \
  -d ticket[isTodo]="false" \
  -d ticket[isClosed]="false"
<?php $api->ticket->update({$ticket_id}, [
    "subject"    => "Your order has a slight delay",
    "memo"       => "",
    "isAnswered" => "false",
    "isTodo"     => "false",
    "isClosed"   => "false"
]);

Example Json payload

{
  "ticket": {
    "subject": "Your order has a slight delay",
    "memo": "",
    "customer": 1,
    "isAnswered": false,
    "isTodo": false,
    "isClosed": false
  }
}

Example response

{
    "ticket": {
        "id": 8873,
        "createdAt": "2019-07-29T18:59:12+00:00",
        "updatedAt": "2019-07-29T18:59:12+00:00",
        "isAnswered": false,
        "isClosed": false,
        "isTodo": false,
        "subject": "Your order has a slight delay",
        "memo": "",
        "doNotifyAnswered": false,
        "language": {
            "id": 18,
            "code": "us",
            "locale": "en_US",
            "title": "English (US)"
        },
        "customer": {
            "resource": {
                "id": 1118417,
                "url": "customers/1118417",
                "link": "https://api.shoplightspeed.com/us/customers/1118417.json"
            }
        },
        "messages": {
            "resource": {
                "id": false,
                "url": "tickets/8873/messages",
                "link": "https://api.shoplightspeed.com/us/tickets/8873/messages.json"
            }
        }
    }
}

Arguments

isAnswered If the ticket has been answered (can be set manually). (format: boolean){“isAnswered”: “true|false”}
isClosed If the ticket is closed (can be set manually) (format: boolean){“isClosed”: “true|false”}
isTodo If the ticket has been turned into a todo. (format: boolean){“isTodo”: “true|false”}
subject The subject of a ticket. {“subject”: “subject”}
memo The internal memo. {“memo”: “memo”}
doNotifyAnswered If the customer should be notified of an answer. (format: boolean){“doNotifyAnswered”: “true|false”}

DELETE Delete a ticket

Delete an existing ticket based on the unique identifier.

Definition

DELETE /tickets/{ticket_id}.json

Example request

curl -X DELETE https://api.shoplightspeed.com/en/tickets/{ticket_id}.json \
  -u {key}:{secret}
<?php $api->tickets->delete($ticket_id);

Example response

HTTP/1.1 204 No Content

Arguments

id The unique numeric identifier for the ticket. {“id”: {id}}