├── .gitignore ├── README.md ├── examples └── python │ ├── README.md │ ├── logo.png │ ├── mojo-api-v2-python-examples.py │ └── testfile.txt └── v1-depracated-example └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | # Default ignored files 2 | /shelf/ 3 | /workspace.xml 4 | # Editor-based HTTP Client requests 5 | /httpRequests/ 6 | # Datasource local storage ignored files 7 | /dataSources/ 8 | /dataSources.local.xml 9 | /.idea 10 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Mojo Helpdesk API v2 Documentation 2 | 3 | [![Services Health](https://mojohelpdesk.montastic.io/badge)](https://mojohelpdesk.montastic.io) 4 | 5 | [Mojo Helpdesk](https://www.mojohelpdesk.com) is a ticket tracking software as a service (Saas). 6 | It is developed by [Metadot](https://www.metadot.com). 7 | 8 | This document describes its public API v2. API v1 is deprecated. 9 | 10 | ## About Mojo Helpdesk API 11 | 12 | Mojo Helpdesk API is easy to use. It allows 13 | 3rd party developers to build web, desktop, and server applications or simple 14 | scripts that can communicate directly with the Mojo Helpdesk service. 15 | The communication is done by using `RESTful` `HTTP` requests in `JSON` format. 16 | `XML` is not supported. 17 | 18 | ## Example usage in Python 19 | 20 | A Mojo Helpdesk example API usage Python script is available 21 | [here](https://github.com/mojohelpdesk/mojohelpdesk-api-doc/tree/master/examples/python). 22 | 23 | ## Authentication 24 | 25 | In the code below, replace `access_key` parameter with your access key 26 | (it can be found in your profile). 27 | 28 | The Mojo Helpdesk API requires an access key that is found 29 | in the Mojo Helpdesk user profile. 30 | 31 | ## Requirements 32 | 33 | - curl version 8.6 or higher 34 | 35 | ## Tickets 36 | 37 | ### List tickets 38 | 39 | curl https://app.mojohelpdesk.com/api/v2/tickets?access_key=XXX 40 | 41 | List of tickets API call supports **paging**, with optional parameters 42 | `per_page` and `page` parameters. `per_page` default value is 30, the maximum - 100: 43 | 44 | CURL: 45 | 46 | curl https://app.mojohelpdesk.com/api/v2/tickets?access_key=xxx\&per_page=20\&page=3 47 | 48 | JavaScript: 49 | 50 | const Http = new XMLHttpRequest(); 51 | const url='https://app.mojohelpdesk.com/api/v2/tickets?access_key=XXX'; 52 | Http.open("GET", url); 53 | Http.setRequestHeader("Content-Type", "application/json"); 54 | Http.send(); 55 | Http.onreadystatechange = (e) => { 56 | console.log(Http.responseText) 57 | } 58 | 59 | Sorting parameters: 60 | 61 | - **sort_by** - id, title, description, user_id, assigned_to_id, status_id, 62 | ticket_form_id, priority_id, ticket_queue_id, company_id, rating, rated_on, 63 | created_on, updated_on, status_changed_on, solved_on, assigned_on, 64 | ticket_type_id, due_on, scheduled_on 65 | - **sort_order** - asc, desc 66 | 67 | Default sorting is by 'id', descending. 68 | 69 | ### Show ticket 70 | 71 | CURL: 72 | 73 | curl https://app.mojohelpdesk.com/api/v2/tickets/123456?access_key=XXX 74 | 75 | JavaScript: 76 | 77 | const Http = new XMLHttpRequest(); 78 | const url='https://app.mojohelpdesk.com/api/v2/tickets/123456?access_key=XXX'; 79 | Http.open("GET", url); 80 | Http.setRequestHeader("Content-Type", "application/json"); 81 | Http.send(); 82 | Http.onreadystatechange = (e) => { 83 | console.log(Http.responseText) 84 | } 85 | 86 | ### Create ticket 87 | 88 | CURL: 89 | 90 | curl -H 'Content-type: application/json' https://app.mojohelpdesk.com/api/v2/tickets?access_key=XXX -X POST -d '{"title":"Test ticket","description":"Testing API for ticket creation","ticket_queue_id":"8","priority_id":"30"}' 91 | 92 | JavaScript: 93 | 94 | const formData = new FormData(); 95 | formData.append('title', 'Test ticket'); 96 | formData.append('description', 'description'); 97 | formData.append('ticket_queue_id', 8); 98 | formData.append('priority_id', 30); 99 | formData.append('access_key', 'XXX'); 100 | 101 | const Http = new XMLHttpRequest(); 102 | Http.open("POST", "https://app.mojohelpdesk.com/api/v2/tickets"); 103 | Http.setRequestHeader("Content-Disposition", "multipart/form-data"); 104 | Http.send(formData); 105 | 106 | Http.onreadystatechange = (e) => { 107 | console.log(Http.responseText) 108 | } 109 | 110 | ### Create ticket with attachments 111 | 112 | HTML/JavaScript: 113 | 114 | 115 | 116 | 143 | 144 | ### Create ticket with user 145 | 146 | curl -H 'Content-type: application/json' https://app.mojohelpdesk.com/api/v2/tickets?access_key=XXX -X POST -d '{"title":"Test ticket","description":"Testing API for ticket creation","ticket_queue_id":"8","priority_id":"30", "user":{"email":"customer@someplace.com"}}' 147 | 148 | #### Additional parameters for ticket creation 149 | 150 | - suppress_user_notification - Boolean when set to `true` will not send any email to notify for the ticket creation 151 | 152 | ### Update ticket 153 | 154 | curl -H 'Content-type: application/json' https://app.mojohelpdesk.com/api/v2/tickets/113?access_key=XXX -X PUT -d '{"title":"Test ticket API"}' 155 | 156 | ### List of events for a ticket 157 | 158 | curl https://app.mojohelpdesk.com/api/v2/tickets/113/events?access_key=XXX 159 | 160 | ### Add tag to a ticket 161 | 162 | curl -H 'Content-type: application/json' https://app.mojohelpdesk.com/api/v2/tickets/113/add_tag?access_key=XXX -X POST -d '{"tag_label":"Test"}' 163 | 164 | ### Remove tag from a ticket 165 | 166 | curl -H 'Content-type: application/json' https://app.mojohelpdesk.com/api/v2/tickets/113/remove_tag?access_key=XXX -X POST -d '{"tag_label":"Test"}' 167 | 168 | ### Destroy ticket 169 | 170 | curl https://app.mojohelpdesk.com/api/v2/tickets/113?access_key=XXX -X DELETE 171 | 172 | ### Ticket input fields 173 | 174 | - title - String 175 | - description - String 176 | - ticket_queue_id - Integer 177 | - priority_id - Integer 178 | - 10 emergency 179 | - 20 urgent 180 | - 30 normal 181 | - 40 low 182 | - status_id - Integer 183 | - 10 new 184 | - 20 in progress 185 | - 30 on hold 186 | - 40 information requested 187 | - 50 solved 188 | - 60 closed 189 | - ticket_type_id - Integer 190 | - assigned_to_id - Integer 191 | - ticket_form_id - Integer (if omitted, the default form would be used) 192 | - custom_field_XXX - String (where XXX is the name of the custom field, 193 | i.e. custom_field_my_awesome_field) 194 | - user_id - Integer 195 | - cc - String 196 | - asset_tag - String 197 | - asset_id - Integer 198 | 199 | ## Ticket comments 200 | 201 | ### Listing comments for a ticket 202 | 203 | curl https://app.mojohelpdesk.com/api/v2/tickets/114/comments?access_key=XXX 204 | 205 | ### Create comment 206 | 207 | curl -H 'Content-type: application/json' https://app.mojohelpdesk.com/api/v2/tickets/88/comments?access_key=XXX -X POST -d '{"body":"New comment"}' 208 | 209 | ### Comment input fields 210 | 211 | - body - String 212 | - time_spent - Integer 213 | - cc - String 214 | 215 | ### Additional parameters for comment creation 216 | 217 | - suppress_user_notification - Boolean 218 | 219 | ## Ticket staff notes 220 | 221 | ### Listing staff notes for a ticket 222 | 223 | curl https://app.mojohelpdesk.com/api/v2/tickets/114/staff_notes?access_key=XXX 224 | 225 | ### Create staff note 226 | 227 | curl -H 'Content-type: application/json' https://app.mojohelpdesk.com/api/v2/tickets/88/staff_notes?access_key=XXX -X POST -d '{"body":"New staff note"}' 228 | 229 | ### Staff note input fields 230 | 231 | - body - String 232 | - cc - String 233 | - time_spent - Integer 234 | 235 | ## Ticket attachments 236 | 237 | ### List attachments for a ticket 238 | 239 | curl https://app.mojohelpdesk.com/api/v2/tickets/211402/attachments?access_key=XXX 240 | 241 | ### Add attachment to a ticket 242 | 243 | curl -F "file=@/home/user/my-file.txt" https://app.mojohelpdesk.com/api/v2/tickets/211402/attachments?staff_only=true\&access_key=XXX -X POST 244 | 245 | Additional url params: 246 | 247 | - `staff_only` - true/false 248 | 249 | ### Download an attachment 250 | 251 | curl https://app.mojohelpdesk.com/api/v2/attachments/6422878?access_key=XXX 252 | 253 | ### Delete an attachment 254 | 255 | curl https://app.mojohelpdesk.com/api/v2/attachments/6422878?access_key=XXX -X DELETE 256 | 257 | ## Ticket search 258 | 259 | The last part of the urls is the search query - the format is the same as the 260 | one generated for the advanced search on the web interface. Note the usage of 261 | `%20` instead of space, `\&` instead of just `&`, `\(` instead of `(`, `\<` 262 | instead of `<`. 263 | 264 | Additional url params: 265 | 266 | - `sf` - sort field name (same as the web form search, i.e. priority_id) 267 | - `r` - 0/1 - reverse sort 268 | - `per_page` - results per page (default 10, min 10) 269 | - `page` - page number (default 1) 270 | 271 | ### All open tickets 272 | 273 | curl https://app.mojohelpdesk.com/api/v2/tickets/search?query=status.id:\(\<50\)\&sf=created_on\&r=0\&access_key=XXX 274 | 275 | ### All urgent open tickets 276 | 277 | curl https://app.mojohelpdesk.com/api/v2/tickets/search?query=priority.id:\(\<=20\)%20AND%20status.id:\(\<50\)&sf=created_on\&r=0\&access_key=XXX 278 | 279 | ### All open tickets in certain queue 280 | 281 | curl https://app.mojohelpdesk.com/api/v2/tickets/search?query=queue.id:19647%20AND%20status.id:\(\<50\)\&sf=created_on\&r=0\&access_key=XXX 282 | 283 | ### All tickets with due date 284 | 285 | curl https://app.mojohelpdesk.com/api/v2/tickets/search?query=_exists_:due_on\&sf=created_on\&r=0\&access_key=XXX 286 | 287 | ### List of sortable fields 288 | 289 | - created_on 290 | - due_on 291 | - rated_on 292 | - scheduled_on 293 | - solved_on 294 | - updated_on 295 | 296 | ### List of searchable fields 297 | 298 | - assignee.id 299 | - ~~assignee.name~~ - **DEPRECATED** 300 | → Retrieve the user ID and use it in the assignee.id search parameter instead. 301 | - assignee.email 302 | - ~~comments.id~~ - **DEPRECATED** 303 | - comments.body 304 | - ~~comments.created_on~~ - **DEPRECATED** 305 | - ~~comments.time_spent~~ - **DEPRECATED** 306 | - ~~comments.user.id~~ - **DEPRECATED** 307 | - ~~comments.user.name~~ - **DEPRECATED** 308 | - ~~comments.user.email~~ - **DEPRECATED** 309 | - company.id 310 | - ~~company.name~~ - **DEPRECATED** 311 | → Retrieve the company ID and use it in the company.id search parameter instead. 312 | - created_by.id 313 | - created_by.name 314 | - created_by.email 315 | - created_on 316 | - custom_fields 317 | - description 318 | - due_on 319 | - priority.id 320 | - ~~priority.name~~ - **DEPRECATED** 321 | → Retrieve the priority ID and use it in the priority.id search parameter instead. 322 | - queue.id 323 | - ~~queue.name~~ - **DEPRECATED** 324 | → Retrieve the queue ID and use it in the queue.id search parameter instead. 325 | - rating 326 | - rated_on 327 | - scheduled_on 328 | - solved_on 329 | - status.id 330 | - ~~status.name~~ - **DEPRECATED** 331 | → Retrieve the status ID and use it in the status.id search parameter instead. 332 | - status_changed_on 333 | - type.id 334 | - ~~type.name~~ - **DEPRECATED** 335 | → Retrieve the type ID and use it in the type.id search parameter instead. 336 | - title 337 | - updated_on 338 | 339 | #### Search notes 340 | 341 | - Format of all date fields is: 2013-11-11T21:37:02Z 342 | - To search for range of date/time (i.e. for created_on field): 343 | - created_on:\[2013-11-11T21:37:02Z TO \*\] (for dates after the given) 344 | - created_on:\[\* TO 2013-11-11T21:37:02Z\] (for dates before the given) 345 | - created_on:\[2013-10-11T21:37:02Z TO 2013-11-11T21:37:02Z\] (for dates 346 | between the given) 347 | - Surround all string values with parentheses and double quotes like the 348 | following examples: 349 | - created_by.email:("") 350 | 351 | ## Ticket queues 352 | 353 | ### List of ticket queues 354 | 355 | curl https://app.mojohelpdesk.com/api/v2/ticket_queues?access_key=XXX 356 | 357 | ### List of ticket queues supports paging, with optional parameters per_page and page parameters. If per_page is missing, by default it will return 30 items per page 358 | 359 | curl https://app.mojohelpdesk.com/api/v2/ticket_queues?access_key=XXX\&per_page=10\&page=2 360 | 361 | ### Show ticket queue 362 | 363 | curl https://app.mojohelpdesk.com/api/v2/ticket_queues/8?access_key=XXX 364 | 365 | ### Create ticket queue 366 | 367 | curl -H 'Content-type: application/json' https://app.mojohelpdesk.com/api/v2/ticket_queues?access_key=XXX -X POST -d '{"name":"My queue"}' 368 | 369 | ### Update ticket queue 370 | 371 | curl -H 'Content-type: application/json' https://app.mojohelpdesk.com/api/v2/ticket_queues/11?access_key=XXX -X PUT -d '{"name":"My precious queue"}' 372 | 373 | ### Destroy ticket queue 374 | 375 | curl https://app.mojohelpdesk.com/api/v2/ticket_queues/10?access_key=XXX -X DELETE 376 | 377 | ### Ticket queue input fields 378 | 379 | - name 380 | - email_alias 381 | - email_forward 382 | 383 | ## Groups (formerly called companies) 384 | 385 | ### List of groups 386 | 387 | curl https://app.mojohelpdesk.com/api/v2/groups?access_key=XXX 388 | 389 | ### List of groups supports paging, with optional parameters per_page and page parameters. If per_page is missing, by default it will return 30 items per page 390 | 391 | curl https://app.mojohelpdesk.com/api/v2/groups?access_key=XXX\&per_page=10\&page=2 392 | 393 | ### Create group 394 | 395 | curl -H 'Content-type: application/json' https://app.mojohelpdesk.com/api/v2/groups?access_key=XXX -X POST -d '{"name":"My very own group"}' 396 | 397 | ### Update group 398 | 399 | curl -H 'Content-type: application/json' https://app.mojohelpdesk.com/api/v2/groups/1999?access_key=XXX -X PUT -d '{"website-url":"www.google.com"}' 400 | 401 | ### Destroy group 402 | 403 | curl https://app.mojohelpdesk.com/api/v2/groups/1999?access_key=XXX -X DELETE 404 | 405 | ### Group input fields 406 | 407 | - name 408 | - primary_contact_id (ID of existing helpdesk user) 409 | - billing_contact_id (ID of existing helpdesk user) 410 | - support_level_id 411 | - support_status_id (0 - active, 1 - delinquent) 412 | - support_start_date 413 | - support_end_date 414 | - support_info_url 415 | - address 416 | - address2 417 | - city 418 | - state 419 | - zip 420 | - country 421 | - website_url 422 | - notes 423 | 424 | ## Users 425 | 426 | ### List of users 427 | 428 | curl https://app.mojohelpdesk.com/api/v2/users?access_key=XXX 429 | 430 | ### List of agents 431 | 432 | curl https://app.mojohelpdesk.com/api/v2/users/techs?access_key=XXX 433 | 434 | ### List of users supports paging, with optional parameters per_page and page parameters. If per_page is missing, by default it will return 30 items per page 435 | 436 | curl https://app.mojohelpdesk.com/api/v2/users?access_key=XXX\&per_page=10\&page=2 437 | 438 | ### Show user 439 | 440 | curl https://app.mojohelpdesk.com/api/v2/users/1?access_key=XXX 441 | 442 | ### Get user by email address 443 | 444 | curl https://app.mojohelpdesk.com/api/v2/users/get_by_email?email=someone@company.com&access_key=XXX 445 | 446 | ### Create user 447 | 448 | curl -H 'Content-type: application/json' https://app.mojohelpdesk.com/api/v2/users?access_key=XXX\&send_welcome_email=1 -X POST -d '{"email":"ivaylo+test@metadot.com","first_name":"Ivaylo","last_name":"Georgiev","company_id":"888","password":"111111"}' 449 | 450 | ### Update user 451 | 452 | curl -H 'Content-type: application/json' https://app.mojohelpdesk.com/api/v2/users/1999?access_key=XXX -X PUT -d '{"user_notes":"Thats me again."}' 453 | 454 | ### Destroy user 455 | 456 | curl https://app.mojohelpdesk.com/api/v2/users/1999?access_key=XXX -X DELETE 457 | 458 | ### User input fields 459 | 460 | - email 461 | - first_name 462 | - last_name 463 | - work_phone 464 | - cell_phone 465 | - home_phone 466 | - user_notes 467 | - company_id 468 | - password 469 | - is_active 470 | - role_id 471 | 472 | ### role_id values 473 | 474 | - 10 - regular user 475 | - 15 - restricted technician 476 | - 20 - technician 477 | - 30 - manager 478 | - 35 - admin 479 | - 40 - owner 480 | 481 | ## Ticket tags 482 | 483 | ### List of ticket tags 484 | 485 | curl https://app.mojohelpdesk.com/api/v2/tags?access_key=XXX 486 | 487 | ### List of tags supports paging, with optional parameters per_page and page parameters. If per_page is missing, by default it will return 30 items per page 488 | 489 | curl https://app.mojohelpdesk.com/api/v2/tags?access_key=XXX\&per_page=10\&page=2 490 | 491 | ### Show tag 492 | 493 | curl https://app.mojohelpdesk.com/api/v2/tags/8?access_key=XXX 494 | 495 | ### Create tag 496 | 497 | curl -H 'Content-type: application/json' https://app.mojohelpdesk.com/api/v2/tags?access_key=XXX -X POST -d '{"label":"Test","color":"#777777"}' 498 | 499 | ### Update tag 500 | 501 | curl -H 'Content-type: application/json' https://app.mojohelpdesk.com/api/v2/tags/11?access_key=XXX -X PUT -d '{"color":"#ff0000"}' 502 | 503 | ### Destroy tag 504 | 505 | curl https://app.mojohelpdesk.com/api/v2/tags/10?access_key=XXX -X DELETE 506 | 507 | ### Tag input fields 508 | 509 | - label 510 | - color 511 | 512 | ## Ticket tasks 513 | 514 | ### List of ticket tasks 515 | 516 | curl https://app.mojohelpdesk.com/api/v2/tickets/88/tasks?access_key=XXX 517 | 518 | ### Create ticket task 519 | 520 | curl -H 'Content-type: application/json' https://app.mojohelpdesk.com/api/v2/tickets/88/tasks?access_key=XXX -X POST -d '{"title":"Test"}' 521 | 522 | ### Update ticket task 523 | 524 | curl -H 'Content-type: application/json' https://app.mojohelpdesk.com/api/v2/tickets/88/tasks/777?access_key=XXX -X PUT -d '{"notes":"Help"}' 525 | 526 | ### Destroy ticket task 527 | 528 | curl https://app.mojohelpdesk.com/api/v2/tickets/88/tasks/777?access_key=XXX -X DELETE 529 | 530 | ### Task input fields 531 | 532 | - title 533 | - notes 534 | - is_completed 535 | 536 | ## Access rights on ticket queues 537 | 538 | ### List access rights for restricted agents 539 | 540 | curl https://app.mojohelpdesk.com/api/v2/access_rights/restricted_agents?access_key=XXX 541 | 542 | ### List access rights for groups 543 | 544 | curl https://app.mojohelpdesk.com/api/v2/access_rights/groups?access_key=XXX 545 | 546 | ### Show access rights for a restricted agent 547 | 548 | curl https://app.mojohelpdesk.com/api/v2/users/1819458/access_rights?access_key=XXX 549 | 550 | ### Show access rights for a group 551 | 552 | curl https://app.mojohelpdesk.com/api/v2/groups/124147/access_rights?access_key=XXX 553 | 554 | ### Set access right for a restricted agent on a single queue 555 | 556 | curl -H 'Content-type: application/json' https://app.mojohelpdesk.com/api/v2/users/1819458/access_rights?access_key=XXX -X POST -d '{"ticket_queue_id":"94748","has_access":"true"}' 557 | 558 | ### Set access right for a restricted agent on multiple queues 559 | 560 | curl -H 'Content-type: application/json' https://app.mojohelpdesk.com/api/v2/users/1819458/access_rights/set?access_key=XXX -X POST -d '{"keys":["94748","15"],"has_access":"true"}' 561 | 562 | ### Set access right for a group on a single queue 563 | 564 | curl -H 'Content-type: application/json' https://app.mojohelpdesk.com/api/v2/groups/124147/access_rights?access_key=XXX -X POST -d '{"ticket_queue_id":"94748","has_access":"true"}' 565 | 566 | ### Set access right for a group on all queues 567 | 568 | curl -H 'Content-type: application/json' https://app.mojohelpdesk.com/api/v2/groups/124147/access_rights?access_key=XXX -X POST -d '{"has_access_to_all_ticket_queues":"true"}' 569 | 570 | ### Set access right for a group on multiple queues 571 | 572 | curl -H 'Content-type: application/json' https://app.mojohelpdesk.com/api/v2/groups/124147/access_rights/set?access_key=XXX -X POST -d '{"keys":["94748","15"],"has_access":"true"}' 573 | 574 | ## Ticket forms 575 | 576 | ### List of ticket forms 577 | 578 | curl https://app.mojohelpdesk.com/api/v2/ticket_forms?access_key=XXX 579 | 580 | List all forms with some basic information for them. 581 | 582 | ### Show ticket forms 583 | 584 | curl https://app.mojohelpdesk.com/api/v2/ticket_forms/2700?access_key=XXX 585 | 586 | Returns all relevant information for a form, including the list of field attributes, and field rules. 587 | 588 | ## Group tickets access for users 589 | 590 | ### List all groups tickets access for a user 591 | 592 | curl https://app.mojohelpdesk.com/api/v2/users/14/group_access?access_key=XXX 593 | 594 | ### Get single group tickets access for a user 595 | 596 | curl https://app.mojohelpdesk.com/api/v2/users/14/group_access/1234?access_key=XXX 597 | 598 | ### Set single group tickets access for a user 599 | 600 | curl -H 'Content-type: application/json' https://app.mojohelpdesk.com/api/v2/users/14/group_access/1234?access_key=XXX -X POST -d '{"access":"1"}' 601 | 602 | Possible access values: 603 | 604 | - 0 - no access 605 | - 1 - full access 606 | - 2 - comment only 607 | 608 | ## Ticket types 609 | 610 | ### List of ticket types 611 | 612 | curl https://app.mojohelpdesk.com/api/v2/ticket_types?access_key=XXX 613 | 614 | ### Show ticket type 615 | 616 | curl https://app.mojohelpdesk.com/api/v2/ticket_type/8?access_key=XXX 617 | 618 | ### Create ticket type 619 | 620 | curl -H 'Content-type: application/json' https://app.mojohelpdesk.com/api/v2/ticket_types?access_key=XXX -X POST -d '{"name":"My type"}' 621 | 622 | ### Update ticket type 623 | 624 | curl -H 'Content-type: application/json' https://app.mojohelpdesk.com/api/v2/ticket_types/11?access_key=XXX -X PUT -d '{"name":"My precious type"}' 625 | 626 | ### Destroy ticket type 627 | 628 | curl https://app.mojohelpdesk.com/api/v2/ticket_types/10?access_key=XXX -X DELETE 629 | 630 | ### Ticket type input fields 631 | 632 | - name 633 | 634 | ## Assets Management 635 | 636 | ### List of assets 637 | 638 | curl https://app.mojohelpdesk.com/api/v2/assets?access_key=XXX 639 | 640 | ### Show asset 641 | 642 | curl https://app.mojohelpdesk.com/api/v2/assets/1?access_key=XXX 643 | 644 | ### Create asset 645 | 646 | curl -H 'Content-type: application/json' https://app.mojohelpdesk.com/api/v2/assets?access_key=XXX -X POST -d '{"display_name":"My asset", "description":"My very own asset"}' 647 | 648 | ### Update asset 649 | 650 | curl -H 'Content-type: application/json' https://app.mojohelpdesk.com/api/v2/assets/1?access_key=XXX -X PUT -d '{"display_name":"My precious asset"}' 651 | 652 | ### Destroy asset 653 | 654 | curl https://app.mojohelpdesk.com/api/v2/assets/1?access_key=XXX -X DELETE 655 | 656 | ### Asset input fields 657 | 658 | - asset_tag - string 659 | - serial_number - string 660 | - legacy_reference_number - string 661 | - display_name - string 662 | - description - string 663 | - asset_type_id - integer 664 | - location_id - integer 665 | - department_id - integer 666 | - managed_by_id - integer 667 | - used_by_id - integer 668 | - asset_status_id - integer 669 | - notes - string 670 | - purchased_on - date 671 | - cost - float 672 | - purchase_order_number - string 673 | - vendor - string 674 | - replaced_on - date 675 | - warranty_info - string 676 | - end_of_contract_on - date 677 | - contract_notes - string 678 | - create_ticket_days_before - integer 679 | - birthday - date 680 | - visibility - 'staff_only', 'all_users' or 'logged_in_users' 681 | 682 | ### Search assets 683 | 684 | The last part of the urls is the search query - the format is similar as 685 | the one for ticket search. Note the usage of `%20` instead of space, 686 | `\&` instead of just `&`, `\(` instead of `(`, `\<` instead of `<`. 687 | 688 | Url params: 689 | 690 | - `query` - the search query 691 | - `sort_field` - sort field name (same as the web form search, i.e. location_name) 692 | - `sort_order` - 'asc' or 'desc' 693 | - `per_page` - results per page (default 10, min 10, max 100) 694 | - `page` - page number (default 1) 695 | 696 | Sort fields: 697 | 698 | - name 699 | - tag 700 | - asset_type_name 701 | - location_name 702 | - department_name 703 | - managed_by_name 704 | - used_by_name 705 | - status_name 706 | - birthday_sort 707 | - serial_number 708 | - created_on 709 | - updated_on 710 | 711 | Searchable fields: 712 | 713 | - asset_tag 714 | - display_name 715 | - description 716 | - asset_type.id 717 | - ~~asset_type.name~~ - **DEPRECATED** 718 | → Retrieve the asset type ID and use it in the asset_type.id search parameter instead. 719 | - location.id 720 | - ~~location.name~~ - **DEPRECATED** 721 | → Retrieve the location ID and use it in the location.id search parameter instead. 722 | - department.id 723 | - ~~department.name~~ - **DEPRECATED** 724 | → Retrieve the department ID and use it in the department.id search parameter instead. 725 | - managed_by.email 726 | - managed_by.id 727 | - ~~managed_by.name~~ - **DEPRECATED** 728 | → Retrieve the user ID and use it in the managed_by.id search parameter instead. 729 | - used_by.email 730 | - used_by.id 731 | - ~~used_by.name~~ - **DEPRECATED** 732 | → Retrieve the user ID and use it in the used_by.id search parameter instead. 733 | - created_on 734 | - updated_on 735 | - status 736 | - purchased_on 737 | - vendor 738 | - end_of_contract_on 739 | - replaced_on 740 | - serial_number 741 | - birthday 742 | 743 | #### Search all assets in certain location 744 | 745 | curl https://app.mojohelpdesk.com/api/v2/assets/search?query=location.id:123\&sort_field=created_on\&sort_order=asc\&access_key=XXX 746 | 747 | #### Search all assets which display name has 'laptop' in it 748 | 749 | curl https://app.mojohelpdesk.com/api/v2/assets/search?query=display_name:*laptop*\&sort_field=created_on\&sort_order=asc\&access_key=XXX 750 | 751 | ### List of asset statuses 752 | 753 | curl https://app.mojohelpdesk.com/api/v2/asset_statuses?access_key=XXX 754 | 755 | ### Show asset status 756 | 757 | curl https://app.mojohelpdesk.com/api/v2/asset_statuses/1?access_key=XXX 758 | 759 | ### Create asset status 760 | 761 | curl -H 'Content-type: application/json' https://app.mojohelpdesk.com/api/v2/asset_statuses?access_key=XXX -X POST -d '{"name":"My asset type"}' 762 | 763 | ### Update asset status 764 | 765 | curl -H 'Content-type: application/json' https://app.mojohelpdesk.com/api/v2/asset_statuses/1?access_key=XXX -X PUT -d '{"name":"My precious asset type"}' 766 | 767 | ### Destroy asset status 768 | 769 | curl https://app.mojohelpdesk.com/api/v2/asset_statuses/1?access_key=XXX -X DELETE 770 | 771 | ### Asset status input fields 772 | 773 | - name - string 774 | 775 | ### List of asset types 776 | 777 | curl https://app.mojohelpdesk.com/api/v2/asset_types?access_key=XXX 778 | 779 | ### List of asset types in tree order 780 | 781 | curl https://app.mojohelpdesk.com/api/v2/asset_types/tree?access_key=XXX 782 | 783 | ### Show asset type 784 | 785 | curl https://app.mojohelpdesk.com/api/v2/asset_types/1?access_key=XXX 786 | 787 | ### Create asset type 788 | 789 | curl -H 'Content-type: application/json' https://app.mojohelpdesk.com/api/v2/asset_types?access_key=XXX -X POST -d '{"name":"My asset type", "description":"My very own asset type"}' 790 | 791 | ### Update asset type 792 | 793 | curl -H 'Content-type: application/json' https://app.mojohelpdesk.com/api/v2/asset_types/1?access_key=XXX -X PUT -d '{"name":"My precious asset type"}' 794 | 795 | ### Destroy asset type 796 | 797 | curl https://app.mojohelpdesk.com/api/v2/asset_types/1?access_key=XXX -X DELETE 798 | 799 | ### Asset type input fields 800 | 801 | - name - string 802 | - description - string 803 | - parent_id - integer 804 | 805 | ### List of departments 806 | 807 | curl https://app.mojohelpdesk.com/api/v2/departments?access_key=XXX 808 | 809 | ### List of departments in tree order 810 | 811 | curl https://app.mojohelpdesk.com/api/v2/departments/tree?access_key=XXX 812 | 813 | ### Show department 814 | 815 | curl https://app.mojohelpdesk.com/api/v2/departments/1?access_key=XXX 816 | 817 | ### Create department 818 | 819 | curl -H 'Content-type: application/json' https://app.mojohelpdesk.com/api/v2/departments?access_key=XXX -X POST -d '{"name":"My department", "description":"My very own department"}' 820 | 821 | ### Update department 822 | 823 | curl -H 'Content-type: application/json' https://app.mojohelpdesk.com/api/v2/departments/1?access_key=XXX -X PUT -d '{"name":"My precious department"}' 824 | 825 | ### Destroy department 826 | 827 | curl https://app.mojohelpdesk.com/api/v2/departments/1?access_key=XXX -X DELETE 828 | 829 | ### Department input fields 830 | 831 | - name - string 832 | - description - string 833 | - parent_id - integer 834 | 835 | ### List of locations 836 | 837 | curl https://app.mojohelpdesk.com/api/v2/locations?access_key=XXX 838 | 839 | ### List of locations in tree order 840 | 841 | curl https://app.mojohelpdesk.com/api/v2/locations/tree?access_key=XXX 842 | 843 | ### Show location 844 | 845 | curl https://app.mojohelpdesk.com/api/v2/locations/1?access_key=XXX 846 | 847 | ### Create location 848 | 849 | curl -H 'Content-type: application/json' https://app.mojohelpdesk.com/api/v2/locations?access_key=XXX -X POST -d '{"name":"My location", "description":"My very own location"}' 850 | 851 | ### Update location 852 | 853 | curl -H 'Content-type: application/json' https://app.mojohelpdesk.com/api/v2/locations/1?access_key=XXX -X PUT -d '{"name":"My precious location"}' 854 | 855 | ### Destroy location 856 | 857 | curl https://app.mojohelpdesk.com/api/v2/locations/1?access_key=XXX -X DELETE 858 | 859 | ### Location input fields 860 | 861 | - name - string 862 | - description - string 863 | - parent_id - integer 864 | -------------------------------------------------------------------------------- /examples/python/README.md: -------------------------------------------------------------------------------- 1 | # MOJO HELPDESK API PYTHON EXAMPLE 2 | 3 | The script `mojo-api-v2-python-examples.py` is an example how to use Mojo Helpdesk REST JSON API in Python. 4 | 5 | ## Installation 6 | 7 | Install `pip` first then the `requests` module: 8 | 9 | pip install requests 10 | 11 | ## Running the script 12 | 13 | Get your access key from your Mojo Helpdesk account user profile then run: 14 | 15 | ./mojo-api-v2-python-examples.py YOUR_ACCESS_KEY 16 | 17 | ## More info 18 | 19 | See [Mojo Helpdesk API doc](https://github.com/mojohelpdesk/mojohelpdesk-api-doc) 20 | 21 | Enjoy! 22 | -------------------------------------------------------------------------------- /examples/python/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mojohelpdesk/mojohelpdesk-api-doc/84833aead6574a9b463213b6e11ce5ddd2937046/examples/python/logo.png -------------------------------------------------------------------------------- /examples/python/mojo-api-v2-python-examples.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | ### 4 | # Sample Python script to demo Mojo Helpdesk API for basic CRUD operation. 5 | # 6 | # Setup: pip install requests # do this only once. 7 | # 8 | # This Python script showcases and tests Mojo Helpdesk (https://mojohelpdesk.com) REST API. 9 | # This script lives here: https://github.com/mojohelpdesk/mojohelpdesk-api-doc/tree/master/examples/python 10 | # 11 | # Requirement: use your API key that is located in your Mojo Helpdesk user profile. 12 | # 13 | # Usage - see help: ./mojo-helpdesk-api-tests.py 14 | # 15 | # Public domain. 16 | # 17 | # Learn more about Mojo Helpdesk: www.mojohelpdesk.com 18 | # 19 | ## 20 | import requests # pip install requests 21 | import sys 22 | 23 | dn = 'https://app.mojohelpdesk.com' 24 | 25 | 26 | # 27 | # 28 | # Print a "." w/o a carriage return 29 | def show_progress(): 30 | sys.stdout.write(".") # write w/o \n 31 | sys.stdout.flush() 32 | 33 | 34 | if len(sys.argv) < 2: 35 | sys.exit( 36 | "Usage: %s [server domain name (e.g.: http://localhost:3000), default: " 37 | "https://app.mojohelpdesk.com]" % 38 | sys.argv[0]) 39 | 40 | goodKey = sys.argv[1] # get access key 41 | badKey = "bad" 42 | 43 | if len(sys.argv) >= 3: 44 | dn = sys.argv[2] # get hostname 45 | 46 | print("Using DN: %s" % dn) 47 | 48 | # 49 | # Ticket list endpoint / URL 50 | # 51 | apiUrl = dn + '/api/v2/' 52 | 53 | headers = {'Accept': 'application/json', 'Content-Type': 'application/json'} 54 | 55 | # 56 | # 57 | # get ticket list w/ good key 58 | show_progress() 59 | r = requests.get(apiUrl + 'tickets?access_key=' + goodKey, headers=headers) 60 | assert r.status_code == 200, "Error getting ticket list. Expected 200, got: %d" % r.status_code 61 | 62 | # 63 | # 64 | # get w/ bad key => error 401 65 | show_progress() 66 | r = requests.get(apiUrl + 'tickets?access_key=' + badKey, headers=headers) 67 | assert r.status_code == 401, "Should get 'not authorized' error, got: %d" % r.status_code 68 | 69 | # 70 | # 71 | # get ticket queue list 72 | show_progress() 73 | r = requests.get(apiUrl + 'ticket_queues?access_key=' + goodKey, headers=headers) 74 | assert r.status_code == 200, "Error getting ticket queue list. Expected 200, got: %d" % r.status_code 75 | ticket_queues = r.json() 76 | 77 | # 78 | # 79 | # get ticket form list 80 | show_progress() 81 | r = requests.get(apiUrl + 'ticket_forms?access_key=' + goodKey, headers=headers) 82 | assert r.status_code == 200, "Error getting ticket form list. Expected 200, got: %d" % r.status_code 83 | ticket_forms = r.json() 84 | 85 | # 86 | # 87 | # create ticket OK 88 | show_progress() 89 | data = {'title': 'Test ticket', 'description': 'Testing API for ticket creation', 'priority_id': 30, 90 | 'ticket_queue_id': ticket_queues[0]['id']} 91 | r = requests.post(apiUrl + 'tickets?access_key=' + goodKey, json=data, headers=headers) 92 | assert r.status_code == 201, "Error creating: expected 201, got: %d." % r.status_code 93 | ticket = r.json() 94 | 95 | # 96 | # 97 | # create ticket without email notification OK 98 | show_progress() 99 | data = {'suppress_user_notification': 'true', 'title': 'Test ticket', 'description': 'Testing API for ticket creation', 100 | 'priority_id': 30, 'ticket_queue_id': ticket_queues[0]['id']} 101 | r = requests.post(apiUrl + 'tickets?access_key=' + goodKey, json=data, headers=headers) 102 | assert r.status_code == 201, "Error creating: expected 201, got: %d." % r.status_code 103 | ticket = r.json() 104 | 105 | # 106 | # 107 | # create ticket with attachments 108 | show_progress() 109 | data = { 110 | 'title': 'Test ticket', 111 | 'description': 'Testing API for ticket creation', 112 | 'priority_id': 30, 113 | 'ticket_queue_id': ticket_queues[0]['id'] 114 | } 115 | files = { 116 | 'attachment[0][content]': open('testfile.txt', 'rb'), 117 | 'attachment[1][content]': open('logo.png', 'rb') 118 | } 119 | r = requests.post(apiUrl + 'tickets?access_key=' + goodKey, files=files, data=data) 120 | assert r.status_code == 201, "Error creating: expected 201, got: %d." % r.status_code 121 | ticket = r.json() 122 | 123 | # 124 | # 125 | # show ticket OK 126 | show_progress() 127 | r = requests.get(apiUrl + 'tickets/%s' % ticket['id'] + '?access_key=' + goodKey, headers=headers) 128 | assert r.status_code == 200, "Error showing: expected 200, got: %d." % r.status_code 129 | ticket = r.json() 130 | 131 | # 132 | # 133 | # update ticket OK 134 | show_progress() 135 | data = {'title': 'Test ticket API'} 136 | r = requests.put(apiUrl + 'tickets/%s' % ticket['id'] + '?access_key=' + goodKey, json=data, headers=headers) 137 | assert r.status_code == 200, "Error updating: expected 200, got: %d." % r.status_code 138 | 139 | # 140 | # 141 | # get agents details OK 142 | show_progress() 143 | r = requests.get(apiUrl + 'users/techs?access_key=' + goodKey, headers=headers) 144 | assert r.status_code == 200, "Error getting list of agents: expected 200, got: %d." % r.status_code 145 | agents = r.json() 146 | 147 | # 148 | # 149 | # get access rights for restricted agents 150 | show_progress() 151 | r = requests.get(apiUrl + 'access_rights/restricted_agents?access_key=' + goodKey, headers=headers) 152 | assert r.status_code == 200, "Error getting access rights for restricted agents. Expected 200, got: %d" % r.status_code 153 | restricted_agents = r.json() 154 | 155 | # 156 | # 157 | # get access rights for groups 158 | show_progress() 159 | r = requests.get(apiUrl + 'access_rights/groups?access_key=' + goodKey, headers=headers) 160 | assert r.status_code == 200, "Error getting access rights for restricted agents. Expected 200, got: %d" % r.status_code 161 | groups = r.json() 162 | 163 | # 164 | # 165 | # assign ticket OK 166 | show_progress() 167 | data = {'assignee_id': agents[0]['id']} 168 | r = requests.put(apiUrl + 'tickets/%s' % ticket['id'] + '?access_key=' + goodKey, json=data, headers=headers) 169 | assert r.status_code == 200, "Error assigning: expected 200, got: %d." % r.status_code 170 | 171 | # 172 | # 173 | # Add tag to a ticket 174 | show_progress() 175 | data = {'tag_label': 'Test'} 176 | r = requests.post(apiUrl + 'tickets/%s' % ticket['id'] + '/add_tag?access_key=' + goodKey, json=data, headers=headers) 177 | assert r.status_code == 200, "Error adding tag: expected 200, got: %d." % r.status_code 178 | new_tag_list = r.json() 179 | assert len(ticket['tags']) + 1 == len(new_tag_list), 'List of tags should be increased by 1' 180 | 181 | # 182 | # 183 | # Get list of events for a ticket 184 | show_progress() 185 | r = requests.get(apiUrl + 'tickets/%s' % ticket['id'] + '/events?access_key=' + goodKey, headers=headers) 186 | assert r.status_code == 200, "Error getting list of events: expected 200, got: %d." % r.status_code 187 | events = r.json() 188 | assert len(events) > 0, 'List of events should not be empty' 189 | 190 | # 191 | # 192 | # Remove tag from a ticket 193 | show_progress() 194 | data = {'tag_label': 'Test'} 195 | r = requests.post(apiUrl + 'tickets/%s' % ticket['id'] + '/remove_tag?access_key=' + goodKey, json=data, 196 | headers=headers) 197 | assert r.status_code == 200, "Error removing tag: expected 200, got: %d." % r.status_code 198 | new_tag_list = r.json() 199 | assert len(ticket['tags']) == len(new_tag_list), 'List of tags should be decreased by 1' 200 | 201 | # 202 | # 203 | # delete newly created ticket 204 | show_progress() 205 | url = apiUrl + 'tickets/%s' % ticket['id'] + '?access_key=' + goodKey 206 | r = requests.delete(url, headers=headers) 207 | assert r.status_code == 200, "Error deleting: expected 200, got: %d." % r.status_code 208 | 209 | # 210 | # 211 | # search for recently closed tickets 212 | show_progress() 213 | url = apiUrl + 'tickets/search?access_key=' + goodKey + '&query=status.id:60&sf=closed_on&r=1' 214 | r = requests.get(url, headers=headers) 215 | tickets = r.json() 216 | assert r.status_code == 200, "Error getting recently closed tickets: expected 200, got: %d." % r.status_code 217 | assert tickets[0]['status_id'] == 60, "Ticket status should be 60, but got %d" % tickets[0]['status_id'] 218 | 219 | # 220 | # 221 | # search for tickets rated with 3 stars (rating 60) 222 | show_progress() 223 | url = apiUrl + 'tickets/search?access_key=' + goodKey + '&query=rating:60&sf=closed_on&r=1' 224 | r = requests.get(url, headers=headers) 225 | assert r.status_code == 200, "Error getting recently closed tickets: expected 200, got: %d." % r.status_code 226 | tickets = r.json() 227 | assert tickets[0]['rating'] == 60, "Ticket rating should be 60, but got %d" % tickets[0]['rating'] 228 | 229 | # 230 | # 231 | # get asset list 232 | show_progress() 233 | r = requests.get(apiUrl + 'assets?access_key=' + goodKey, headers=headers) 234 | assert r.status_code == 200, "Error getting asset list. Expected 200, got: %d" % r.status_code 235 | assets = r.json() 236 | 237 | # 238 | # 239 | # get asset status list 240 | show_progress() 241 | r = requests.get(apiUrl + 'asset_statuses?access_key=' + goodKey, headers=headers) 242 | assert r.status_code == 200, "Error getting asset status list. Expected 200, got: %d" % r.status_code 243 | asset_statuses = r.json() 244 | 245 | # 246 | # 247 | # get asset type list 248 | show_progress() 249 | r = requests.get(apiUrl + 'asset_types?access_key=' + goodKey, headers=headers) 250 | assert r.status_code == 200, "Error getting asset type list. Expected 200, got: %d" % r.status_code 251 | asset_types = r.json() 252 | 253 | # 254 | # 255 | # get department list 256 | show_progress() 257 | r = requests.get(apiUrl + 'departments?access_key=' + goodKey, headers=headers) 258 | assert r.status_code == 200, "Error getting department list. Expected 200, got: %d" % r.status_code 259 | departments = r.json() 260 | 261 | # 262 | # 263 | # get location list 264 | show_progress() 265 | r = requests.get(apiUrl + 'locations?access_key=' + goodKey, headers=headers) 266 | assert r.status_code == 200, "Error getting location list. Expected 200, got: %d" % r.status_code 267 | locations = r.json() 268 | 269 | print("\n==================") 270 | print("==== TESTS OK ====") 271 | print("==================\n") 272 | -------------------------------------------------------------------------------- /examples/python/testfile.txt: -------------------------------------------------------------------------------- 1 | # this file is needed by the Python script. 2 | # Do not delete. 3 | -------------------------------------------------------------------------------- /v1-depracated-example/README.md: -------------------------------------------------------------------------------- 1 | > **This API version is deprecated.** 2 | 3 | > **On May 8th 2023, this API version will be retired.** 4 | 5 | # Mojo Helpdesk API Documentation 6 | 7 | [Mojo Helpdesk](https://www.mojohelpdesk.com) is a ticket tracking service developed by Metadot. This document describes its public API. 8 | 9 | ## About Mojo Helpdesk API 10 | 11 | Mojo Helpdesk API is simplistic and very easy to use. Mojo Helpdesk API allows 3rd party developers to build web, desktop, and server applications or simple scripts that can communicate directly with the Mojo Helpdesk service. The communication is done by using `RESTful` `HTTP` requests and `XML` or `JSON` responses. 12 | 13 | ## Authentication 14 | 15 | In the code below, replace `mysupport.mojohelpdesk.com` with your helpdesk address, and `access_key` parameter with your access key (it can be found in your profile). 16 | 17 | The Mojo Helpdesk API can return XML or JSON. It requires an access key that is found in the Mojo Helpdesk user profile. 18 | 19 | 20 | ## Tickets 21 | ### List tickets 22 | 23 | curl -H 'Accept: application/xml' -H 'Content-type: application/xml' http://mysupport.mojohelpdesk.com/api/tickets?access_key=9c9745101d12aed4d5a67d43747824451f9251d4 24 | 25 | curl -H 'Accept: application/xml' -H 'Content-type: application/xml' http://mysupport.mojohelpdesk.com/api/tickets.xml?access_key=9c9745101d12aed4d5a67d43747824451f9251d4 26 | 27 | curl -H 'Accept: application/xml' -H 'Content-type: application/xml' http://mysupport.mojohelpdesk.com/api/tickets.json?access_key=9c9745101d12aed4d5a67d43747824451f9251d4 28 | 29 | 30 | 31 | List of tickets API call supports **paging**, with optional parameters `per_page` and `page` parameters. `per_page` default value is 30, the maximum - 100: 32 | 33 | curl -H 'Accept: application/xml' -H 'Content-type: application/xml' http://mysupport.mojohelpdesk.com/api/tickets?access_key=9c9745101d12aed4d5a67d43747824451f9251d4\&per_page=20\&page=3 34 | 35 | Sorting parameters: 36 | - **sort_by** - id, title, description, user_id, assigned_to_id, status_id, ticket_form_id, priority_id, ticket_queue_id, company_id, rating, rated_on, created_on, updated_on, status_changed_on, solved_on, assinged_on, ticket_type_id, due_on, scheduled_on 37 | - **sort_order** - asc, desc 38 | 39 | Default sorting is by 'id', descending. 40 | 41 | 42 | ### Show ticket 43 | 44 | curl -H 'Accept: application/xml' -H 'Content-type: application/xml' http://mysupport.mojohelpdesk.com/api/tickets/88?access_key=9c9745101d12aed4d5a67d43747824451f9251d4 45 | 46 | curl -H 'Accept: application/xml' -H 'Content-type: application/xml' http://mysupport.mojohelpdesk.com/api/tickets/88.xml?access_key=9c9745101d12aed4d5a67d43747824451f9251d4 47 | 48 | curl -H 'Accept: application/xml' -H 'Content-type: application/xml' http://mysupport.mojohelpdesk.com/api/tickets/88.json?access_key=9c9745101d12aed4d5a67d43747824451f9251d4 49 | 50 | 51 | 52 | ### Create ticket 53 | 54 | curl -H 'Accept: application/xml' -H 'Content-type: application/xml' http://mysupport.mojohelpdesk.com/api/tickets?access_key=9c9745101d12aed4d5a67d43747824451f9251d4 -X POST -d "Test ticketTesting API for ticket creation830" 55 | 56 | ### Update ticket 57 | 58 | curl -H 'Accept: application/xml' -H 'Content-type: application/xml' http://mysupport.mojohelpdesk.com/api/tickets/113?access_key=9c9745101d12aed4d5a67d43747824451f9251d4 -X PUT -d "Test ticket API" 59 | 60 | 61 | 62 | ### Destroy ticket 63 | 64 | curl -H 'Accept: application/xml' -H 'Content-type: application/xml' http://mysupport.mojohelpdesk.com/api/tickets/113?access_key=9c9745101d12aed4d5a67d43747824451f9251d4 -X DELETE 65 | 66 | ### List of input fields 67 | 68 | - title - String 69 | - description - String 70 | - ticket_queue_id - Integer 71 | - priority_id - Integer 72 | - 10 emergency 73 | - 20 urgent 74 | - 30 normal 75 | - 40 low 76 | - status_id - Integer 77 | - 10 new 78 | - 20 in progress 79 | - 30 on hold 80 | - 40 information requested 81 | - 50 solved 82 | - 60 closed 83 | - ticket_type_id - Integer 84 | - assigned_to_id - Integer 85 | - ticket_form_id - Integer (if omitted, the default form would be used) 86 | - custom_field_XXX - String (where XXX is the name of the custom field, i.e. custom_field_my_awesome_field) 87 | - user_id - Integer 88 | - cc - String 89 | 90 | 91 | ## Ticket comments 92 | ### Listing comments for a ticket: 93 | 94 | curl -H 'Accept: application/xml' -H 'Content-type: application/xml' http://mysupport.mojohelpdesk.com/api/tickets/114/comments?access_key=9c9745101d12aed4d5a67d43747824451f9251d4 95 | 96 | curl -H 'Accept: application/xml' -H 'Content-type: application/xml' http://mysupport.mojohelpdesk.com/api/tickets/114/comments.xml?access_key=9c9745101d12aed4d5a67d43747824451f9251d4 97 | 98 | curl -H 'Accept: application/xml' -H 'Content-type: application/xml' http://mysupport.mojohelpdesk.com/api/tickets/114/comments.json?access_key=9c9745101d12aed4d5a67d43747824451f9251d4 99 | 100 | 101 | 102 | ### Create comment: 103 | 104 | curl -H 'Accept: application/xml' -H 'Content-type: application/xml' http://mysupport.mojohelpdesk.com/api/tickets/88/comments?access_key=9c9745101d12aed4d5a67d43747824451f9251d4 -X POST -d "New comment" 105 | 106 | ### Comment input fields 107 | 108 | - body - String 109 | - is_private - Boolean 110 | - time_spent - Integer 111 | - cc - String 112 | 113 | ### Additional parameters 114 | 115 | - suppress_user_notification - Boolean 116 | 117 | 118 | 119 | ## Ticket search 120 | 121 | The last part of the urls is the search query - the format is the same as the one generated for 122 | the advanced search on the web interface. Note the usage of `%20` instead 123 | of space, `\&` instead of just `&`, `\(` instead of `(`, `\<` instead of `<`. 124 | 125 | Additional url params: 126 | 127 | - `sf` - sort field name (same as the web form search, i.e. priority_id) 128 | - `r` - 0/1 - reverse sort 129 | - `per_page` - results per page (default 10, min 10) 130 | - `page` - page number (default 1) 131 | 132 | #### All open tickets: 133 | 134 | curl -H 'Accept: application/xml' -H 'Content-type: application/xml' http://mysupport.mojohelpdesk.com/api/tickets/search?query=status.id:\(\<50\)\&sf=created_on\&r=0\&access_key=9c9745101d12aed4d5a67d43747824451f9251d4 135 | 136 | #### All urgent open tickets: 137 | 138 | curl -H 'Accept: application/xml' -H 'Content-type: application/xml' http://mysupport.mojohelpdesk.com/api/tickets/search?query=priority.id:\(\<=20\)%20AND%20status.id:\(\<50\)&sf=created_on\&r=0\&access_key=9c9745101d12aed4d5a67d43747824451f9251d4 139 | 140 | #### All open tickets in certain queue: 141 | 142 | curl -H 'Accept: application/xml' -H 'Content-type: application/xml' http://mysupport.mojohelpdesk.com/api/tickets/search?query=queue.id:19647%20AND%20status.id:\(\<50\)\&sf=created_on\&r=0\&access_key=9c9745101d12aed4d5a67d43747824451f9251d4 143 | 144 | #### List of searchable fields: 145 | 146 | - assignee.id 147 | - assignee.name 148 | - assignee.email 149 | - comments.id 150 | - comments.body 151 | - comments.created_on 152 | - comments.time_spent 153 | - comments.user.id 154 | - comments.user.name 155 | - comments.user.email 156 | - company.id 157 | - company.name 158 | - created_by.id 159 | - created_by.name 160 | - created_by.email 161 | - created_on 162 | - custom_fields 163 | - description 164 | - due_on 165 | - priority.id 166 | - priority.name 167 | - queue.id 168 | - queue.name 169 | - rating 170 | - rated_on 171 | - scheduled_on 172 | - solved_on 173 | - status.id 174 | - status.name 175 | - status_changed_on 176 | - type.id 177 | - type.name 178 | - title 179 | - updated_on 180 | 181 | 182 | #### Search notes: 183 | 184 | - Format of all date fields is: 2013-11-11T21:37:02Z 185 | - To search for range of date/time (i.e. for created_on field): 186 | - created_on:\[2013-11-11T21:37:02Z TO *\] (for dates after the given) 187 | - created_on:\[* TO 2013-11-11T21:37:02Z\] (for dates before the given) 188 | - created_on:\[2013-10-11T21:37:02Z TO 2013-11-11T21:37:02Z\] (for dates between the given) 189 | - Surround all string values with parentheses and double quotes like the following examples: 190 | - created_by.email:("myemail@somedomain.com") 191 | - company.name:("My Company, Ltd") 192 | - comments.user.email:("tester@mycompany.com") 193 | 194 | 195 | ## Ticket queues 196 | 197 | 198 | ### List of ticket queues: 199 | 200 | curl -H 'Accept: application/xml' -H 'Content-type: application/xml' http://mysupport.mojohelpdesk.com/api/ticket_queues?access_key=9c9745101d12aed4d5a67d43747824451f9251d4 201 | 202 | curl -H 'Accept: application/xml' -H 'Content-type: application/xml' http://mysupport.mojohelpdesk.com/api/ticket_queues.xml?access_key=9c9745101d12aed4d5a67d43747824451f9251d4 203 | 204 | curl -H 'Accept: application/xml' -H 'Content-type: application/xml' http://mysupport.mojohelpdesk.com/api/ticket_queues.json?access_key=9c9745101d12aed4d5a67d43747824451f9251d4 205 | 206 | 207 | 208 | ### List of ticket queues supports paging, with optional parameters per_page and page parameters. If per_page is missing, by default it will return 30 items per page: 209 | 210 | curl -H 'Accept: application/xml' -H 'Content-type: application/xml' http://mysupport.mojohelpdesk.com/api/ticket_queues?access_key=9c9745101d12aed4d5a67d43747824451f9251d4\&per_page=10\&page=2 211 | 212 | 213 | 214 | ### Show ticket queue: 215 | 216 | curl -H 'Accept: application/xml' -H 'Content-type: application/xml' http://mysupport.mojohelpdesk.com/api/ticket_queues/8?access_key=9c9745101d12aed4d5a67d43747824451f9251d4 217 | 218 | 219 | 220 | ### Create ticket queue: 221 | 222 | curl -H 'Accept: application/xml' -H 'Content-type: application/xml' http://mysupport.mojohelpdesk.com/api/ticket_queues?access_key=9c9745101d12aed4d5a67d43747824451f9251d4 -X POST -d "My queue" 223 | 224 | 225 | 226 | ### Update ticket queue: 227 | 228 | curl -H 'Accept: application/xml' -H 'Content-type: application/xml' http://mysupport.mojohelpdesk.com/api/ticket_queues/11?access_key=9c9745101d12aed4d5a67d43747824451f9251d4 -X PUT -d "My precios queue" 229 | 230 | 231 | 232 | ### Destroy ticket queue: 233 | 234 | curl -H 'Accept: application/xml' -H 'Content-type: application/xml' http://mysupport.mojohelpdesk.com/api/ticket_queues/10?access_key=9c9745101d12aed4d5a67d43747824451f9251d4 -X DELETE 235 | 236 | ### List of input fields 237 | 238 | - `name` 239 | - `email_alias` 240 | - `email_forward` 241 | 242 | 243 | ## Groups (formerly called companies) 244 | 245 | 246 | ### List of companies: 247 | 248 | curl -H 'Accept: application/xml' -H 'Content-type: application/xml' http://mysupport.mojohelpdesk.com/api/companies?access_key=9c9745101d12aed4d5a67d43747824451f9251d4 249 | 250 | curl -H 'Accept: application/xml' -H 'Content-type: application/xml' http://mysupport.mojohelpdesk.com/api/companies.xml?access_key=9c9745101d12aed4d5a67d43747824451f9251d4 251 | 252 | curl -H 'Accept: application/xml' -H 'Content-type: application/xml' http://mysupport.mojohelpdesk.com/api/companies.json?access_key=9c9745101d12aed4d5a67d43747824451f9251d4 253 | 254 | 255 | 256 | ### List of companies supports paging, with optional parameters per_page and page parameters. If per_page is missing, by default it will return 30 items per page: 257 | 258 | curl -H 'Accept: application/xml' -H 'Content-type: application/xml' http://mysupport.mojohelpdesk.com/api/companies?access_key=9c9745101d12aed4d5a67d43747824451f9251d4\&per_page=10\&page=2 259 | 260 | 261 | 262 | ### Create company: 263 | 264 | curl -H 'Accept: application/xml' -H 'Content-type: application/xml' http://mysupport.mojohelpdesk.com/api/companies?access_key=9c9745101d12aed4d5a67d43747824451f9251d4 -X POST -d "My very own company" 265 | 266 | 267 | 268 | ### Update company: 269 | 270 | curl -H 'Accept: application/xml' -H 'Content-type: application/xml' http://mysupport.mojohelpdesk.com/api/companies/1999?access_key=9c9745101d12aed4d5a67d43747824451f9251d4 -X PUT -d "www.google.com" 271 | 272 | 273 | 274 | ### Destroy company: 275 | 276 | curl -H 'Accept: application/xml' -H 'Content-type: application/xml' http://mysupport.mojohelpdesk.com/api/companies/1999?access_key=9c9745101d12aed4d5a67d43747824451f9251d4 -X DELETE 277 | 278 | ### List of input fields 279 | 280 | - name 281 | - primary_contact_id (ID of existing helpdesk user) 282 | - billing_contact_id (ID of existing helpdesk user) 283 | - support_level_id 284 | - support_status_id (0 - active, 1 - delinquent) 285 | - support_start_date 286 | - support_end_date 287 | - support_info_url 288 | - address 289 | - address2 290 | - city 291 | - state 292 | - zip 293 | - country 294 | - website_url 295 | - notes 296 | 297 | 298 | ## Users 299 | 300 | 301 | ### List of users: 302 | 303 | curl -H 'Accept: application/xml' -H 'Content-type: application/xml' http://mysupport.mojohelpdesk.com/api/users?access_key=9c9745101d12aed4d5a67d43747824451f9251d4 304 | 305 | curl -H 'Accept: application/xml' -H 'Content-type: application/xml' http://mysupport.mojohelpdesk.com/api/users.xml?access_key=9c9745101d12aed4d5a67d43747824451f9251d4 306 | 307 | curl -H 'Accept: application/xml' -H 'Content-type: application/xml' http://mysupport.mojohelpdesk.com/api/users.json?access_key=9c9745101d12aed4d5a67d43747824451f9251d4 308 | 309 | ### List of agents: 310 | 311 | curl -H 'Accept: application/xml' -H 'Content-type: application/xml' http://mysupport.mojohelpdesk.com/api/users/techs?access_key=9c9745101d12aed4d5a67d43747824451f9251d4 312 | 313 | curl -H 'Accept: application/xml' -H 'Content-type: application/xml' http://mysupport.mojohelpdesk.com/api/users/techs.xml?access_key=9c9745101d12aed4d5a67d43747824451f9251d4 314 | 315 | 316 | ### List of users supports paging, with optional parameters per_page and page parameters. If per_page is missing, by default it will return 30 items per page: 317 | 318 | curl -H 'Accept: application/xml' -H 'Content-type: application/xml' http://mysupport.mojohelpdesk.com/api/users?access_key=9c9745101d12aed4d5a67d43747824451f9251d4\&per_page=10\&page=2 319 | 320 | 321 | 322 | ### Show user: 323 | 324 | curl -H 'Accept: application/xml' -H 'Content-type: application/xml' http://mysupport.mojohelpdesk.com/api/users/1?access_key=9c9745101d12aed4d5a67d43747824451f9251d4 325 | 326 | curl -H 'Accept: application/xml' -H 'Content-type: application/xml' http://mysupport.mojohelpdesk.com/api/users/1.xml?access_key=9c9745101d12aed4d5a67d43747824451f9251d4 327 | 328 | curl -H 'Accept: application/xml' -H 'Content-type: application/xml' http://mysupport.mojohelpdesk.com/api/users/1.json?access_key=9c9745101d12aed4d5a67d43747824451f9251d4 329 | 330 | ### Get user by email address: 331 | 332 | curl -H 'Accept: application/xml' -H 'Content-type: application/xml' http://mysupport.mojohelpdesk.com/api/users/get_by_email?email=someone@company.com&access_key=9c9745101d12aed4d5a67d43747824451f9251d4 333 | 334 | ### Create user: 335 | 336 | curl -H 'Accept: application/xml' -H 'Content-type: application/xml' http://mysupport.mojohelpdesk.com/api/users?access_key=9c9745101d12aed4d5a67d43747824451f9251d4\&send_welcome_email=1 -X POST -d "ivaylo@metadot.comIvayloGeorgiev888111111" 337 | 338 | 339 | 340 | ### Update user: 341 | 342 | curl -H 'Accept: application/xml' -H 'Content-type: application/xml' http://mysupport.mojohelpdesk.com/api/users/1999?access_key=9c9745101d12aed4d5a67d43747824451f9251d4 -X PUT -d "Thats me again." 343 | 344 | 345 | 346 | ### Destroy user: 347 | 348 | curl -H 'Accept: application/xml' -H 'Content-type: application/xml' http://mysupport.mojohelpdesk.com/api/users/1999?access_key=9c9745101d12aed4d5a67d43747824451f9251d4 -X DELETE 349 | 350 | 351 | 352 | ### List of input fields 353 | 354 | - email 355 | - first_name 356 | - last_name 357 | - work_phone 358 | - cell_phone 359 | - home_phone 360 | - user_notes 361 | - company_id 362 | - password 363 | - is_active 364 | - role_id 365 | 366 | 367 | 368 | ### role_id values: 369 | 370 | - 10 - regular user 371 | - 15 - restricted technician 372 | - 20 - technician 373 | - 30 - manager 374 | - 35 - admin 375 | - 40 - owner 376 | 377 | 378 | --------------------------------------------------------------------------------