json_out for CMD_TICKET_MANAGE & CMD_TICKET

Version 1.51

Feature
Finished

You can add: &json=yes or: &json=yes&last_messages=5 to the end of: CMD_TICKET_MANAGE?action=view&number=000001234&type=ticket To get json output for a given ticket. ------------ Another similar option added for DA 1.51.4 &json=yes&start_message=5 which sets which message to start with. But if you set last_messages, this overrides the start_message, so pick one or the other. The first message is start_message=0, so if there are 5 messages in the ticket, you'd use start_message=4.... or last_messages=1 ------------ The last_messages can be any positive int, and will show the last X number of messages in that ticket. Can use a value higher than the number of messages, it won't hurt anything. Output is very similar to CMD_API_TICKETS, but is json, and uses sub-arrays. There is also an "info" array. Note that each message index is it's array position, so the first message is item 0. The info['start'] item will be the starting array position, and varies if you set last_messages. The message[0]['user'] would be similar to the "to" value. If it's set to "creator" it's from the User. { "0": { "from": "fred", "level": "user", "message": "Help me me me.", "name": "fred", "priority": "20", "status": "open", "subject": "This is my ticket!!", "time": "1479974898", "type": "ticket", "user": "creator" }, "1": { "from": "admin", "level": "admin", "message": "Yes, I can help.nPlease delete yourself.", "name": "admin", "priority": "none", "status": "open", "subject": "Re: This is my ticket!!", "time": "1479976365", "type": "reply", "user": "fred" }, "info": { "num_messages": "2", "start": "0" } }

Interested to try DirectAdmin? Get a 30-day Free Trial!