github.com/rvaralda/deis@v1.4.1/docs/reference/api-v1.0.rst (about) 1 :title: Controller API v1.0 2 :description: The v1.0 REST API for Deis' Controller 3 4 Controller API v1.0 5 =================== 6 7 This is the v1.0 REST API for the :ref:`Controller`. 8 9 10 Authentication 11 -------------- 12 13 14 Register a New User 15 ``````````````````` 16 17 Example Request: 18 19 .. code-block:: console 20 21 POST /v1/auth/register/ HTTP/1.1 22 Host: deis.example.com 23 Content-Type: application/json 24 25 { 26 "username": "test", 27 "password": "opensesame" 28 } 29 30 Optional Parameters: 31 32 .. code-block:: console 33 34 { 35 "email": "test@example.com", 36 "first_name": "test", 37 "last_name": "testerson" 38 } 39 40 Example Response: 41 42 .. code-block:: console 43 44 45 HTTP/1.1 201 CREATED 46 Content-Type: application/json 47 48 { 49 "id": 1, 50 "last_login": "2014-10-19T22:01:00.601Z", 51 "is_superuser": true, 52 "username": "test", 53 "first_name": "test", 54 "last_name": "testerson", 55 "email": "test@example.com", 56 "is_staff": true, 57 "is_active": true, 58 "date_joined": "2014-10-19T22:01:00.601Z", 59 "groups": [], 60 "user_permissions": [] 61 } 62 63 64 Log in 65 `````` 66 67 Example Request: 68 69 .. code-block:: console 70 71 POST /v1/auth/login/ HTTP/1.1 72 Host: deis.example.com 73 Content-Type: application/json 74 75 {"username": "test", "password": "opensesame"} 76 77 Example Response: 78 79 .. code-block:: console 80 81 HTTP/1.1 200 OK 82 Content-Type: application/json 83 84 {"token": "abc123"} 85 86 87 Cancel Account 88 `````````````` 89 90 Example Request: 91 92 .. code-block:: console 93 94 DELETE /v1/auth/cancel/ HTTP/1.1 95 Host: deis.example.com 96 Authorization: token abc123 97 98 Example Response: 99 100 .. code-block:: console 101 102 HTTP/1.1 204 NO CONTENT 103 104 105 Applications 106 ------------ 107 108 109 List all Applications 110 ````````````````````` 111 112 Example Request: 113 114 .. code-block:: console 115 116 GET /v1/apps HTTP/1.1 117 Host: deis.example.com 118 Authorization: token abc123 119 120 Example Response: 121 122 .. code-block:: console 123 124 HTTP/1.1 200 OK 125 Content-Type: application/json 126 127 { 128 "count": 1, 129 "next": null, 130 "previous": null, 131 "results": [ 132 { 133 "created": "2014-01-01T00:00:00UTC", 134 "id": "example-go", 135 "owner": "test", 136 "structure": {}, 137 "updated": "2014-01-01T00:00:00UTC", 138 "url": "example-go.example.com", 139 "uuid": "de1bf5b5-4a72-4f94-a10c-d2a3741cdf75" 140 } 141 ] 142 } 143 144 145 Create an Application 146 ````````````````````` 147 148 Example Request: 149 150 .. code-block:: console 151 152 POST /v1/apps/ HTTP/1.1 153 Host: deis.example.com 154 Content-Type: application/json 155 Authorization: token abc123 156 157 Optional parameters: 158 159 .. code-block:: console 160 161 {"id": "example-go"} 162 163 164 Example Response: 165 166 .. code-block:: console 167 168 HTTP/1.1 201 CREATED 169 Content-Type: application/json 170 171 { 172 "created": "2014-01-01T00:00:00UTC", 173 "id": "example-go", 174 "owner": "test", 175 "structure": {}, 176 "updated": "2014-01-01T00:00:00UTC", 177 "url": "example-go.example.com", 178 "uuid": "de1bf5b5-4a72-4f94-a10c-d2a3741cdf75" 179 } 180 181 182 Destroy an Application 183 `````````````````````` 184 185 Example Request: 186 187 .. code-block:: console 188 189 DELETE /v1/apps/example-go/ HTTP/1.1 190 Host: deis.example.com 191 Authorization: token abc123 192 193 Example Response: 194 195 .. code-block:: console 196 197 HTTP/1.1 204 NO CONTENT 198 199 200 List Application Details 201 ```````````````````````` 202 203 Example Request: 204 205 .. code-block:: console 206 207 GET /v1/apps/example-go/ HTTP/1.1 208 Host: deis.example.com 209 Authorization: token abc123 210 211 Example Response: 212 213 .. code-block:: console 214 215 HTTP/1.1 200 OK 216 Content-Type: application/json 217 218 { 219 "created": "2014-01-01T00:00:00UTC", 220 "id": "example-go", 221 "owner": "test", 222 "structure": {}, 223 "updated": "2014-01-01T00:00:00UTC", 224 "url": "example-go.example.com", 225 "uuid": "de1bf5b5-4a72-4f94-a10c-d2a3741cdf75" 226 } 227 228 229 Retrieve Application Logs 230 ````````````````````````` 231 232 Example Request: 233 234 .. code-block:: console 235 236 GET /v1/apps/example-go/logs/ HTTP/1.1 237 Host: deis.example.com 238 Authorization: token abc123 239 240 Example Response: 241 242 .. code-block:: console 243 244 HTTP/1.1 200 OK 245 Content-Type: text/plain 246 247 "16:51:14 deis[api]: test created initial release\n" 248 249 250 Run one-off Commands 251 ```````````````````` 252 253 .. code-block:: console 254 255 POST /v1/apps/example-go/run/ HTTP/1.1 256 Host: deis.example.com 257 Content-Type: application/json 258 Authorization: token abc123 259 260 {"command": "echo hi"} 261 262 Example Response: 263 264 .. code-block:: console 265 266 HTTP/1.1 200 OK 267 Content-Type: application/json 268 269 {"rc": 0, "output": "hi"} 270 271 272 Containers 273 ---------- 274 275 276 List all Containers 277 ``````````````````` 278 279 Example Request: 280 281 .. code-block:: console 282 283 GET /v1/apps/example-go/containers/ HTTP/1.1 284 Host: deis.example.com 285 Authorization: token abc123 286 287 Example Response: 288 289 .. code-block:: console 290 291 HTTP/1.1 200 OK 292 Content-Type: application/json 293 294 { 295 "count": 1, 296 "next": null, 297 "previous": null, 298 "results": [ 299 { 300 "owner": "test", 301 "app": "example-go", 302 "release": "v2", 303 "created": "2014-01-01T00:00:00UTC", 304 "updated": "2014-01-01T00:00:00UTC", 305 "uuid": "de1bf5b5-4a72-4f94-a10c-d2a3741cdf75", 306 "type": "web", 307 "num": 1, 308 "state": "up" 309 } 310 ] 311 } 312 313 314 List all Containers by Type 315 ``````````````````````````` 316 317 Example Request: 318 319 .. code-block:: console 320 321 GET /v1/apps/example-go/containers/web/ HTTP/1.1 322 Host: deis.example.com 323 Authorization: token abc123 324 325 Example Response: 326 327 .. code-block:: console 328 329 HTTP/1.1 200 OK 330 Content-Type: application/json 331 332 { 333 "count": 1, 334 "next": null, 335 "previous": null, 336 "results": [ 337 { 338 "owner": "test", 339 "app": "example-go", 340 "release": "v2", 341 "created": "2014-01-01T00:00:00UTC", 342 "updated": "2014-01-01T00:00:00UTC", 343 "uuid": "de1bf5b5-4a72-4f94-a10c-d2a3741cdf75", 344 "type": "web", 345 "num": 1, 346 "state": "up" 347 } 348 ] 349 } 350 351 352 Scale Containers 353 ```````````````` 354 355 Example Request: 356 357 .. code-block:: console 358 359 POST /v1/apps/example-go/scale/ HTTP/1.1 360 Host: deis.example.com 361 Content-Type: application/json 362 Authorization: token abc123 363 364 {"web": 3} 365 366 Example Response: 367 368 .. code-block:: console 369 370 HTTP/1.1 204 NO CONTENT 371 372 373 Configuration 374 ------------- 375 376 377 List Application Configuration 378 `````````````````````````````` 379 380 Example Request: 381 382 .. code-block:: console 383 384 GET /v1/apps/example-go/config/ HTTP/1.1 385 Host: deis.example.com 386 Authorization: token abc123 387 388 Example Response: 389 390 .. code-block:: console 391 392 HTTP/1.1 200 OK 393 Content-Type: application/json 394 395 { 396 "owner": "test", 397 "app": "example-go", 398 "values": {}, 399 "memory": {}, 400 "cpu": {}, 401 "tags": {}, 402 "created": "2014-01-01T00:00:00UTC", 403 "updated": "2014-01-01T00:00:00UTC", 404 "uuid": "de1bf5b5-4a72-4f94-a10c-d2a3741cdf75" 405 } 406 407 408 Create new Config 409 ````````````````` 410 411 Example Request: 412 413 .. code-block:: console 414 415 POST /v1/apps/example-go/config/ HTTP/1.1 416 Host: deis.example.com 417 Content-Type: application/json 418 Authorization: token abc123 419 420 {"values": {"HELLO": "world"}} 421 422 Example Response: 423 424 .. code-block:: console 425 426 HTTP/1.1 201 CREATED 427 Content-Type: application/json 428 X-Deis-Release: 3 429 430 { 431 "owner": "test", 432 "app": "example-go", 433 "values": { 434 "DEIS_APP": "example-go", 435 "DEIS_RELEASE": "v3", 436 "HELLO": "world" 437 }, 438 "memory": {}, 439 "cpu": {}, 440 "tags": {}, 441 "created": "2014-01-01T00:00:00UTC", 442 "updated": "2014-01-01T00:00:00UTC", 443 "uuid": "de1bf5b5-4a72-4f94-a10c-d2a3741cdf75" 444 } 445 446 447 Unset Config Variable 448 ````````````````````` 449 450 Example Request: 451 452 .. code-block:: console 453 454 POST /v1/apps/example-go/config/ HTTP/1.1 455 Host: deis.example.com 456 Content-Type: application/json 457 Authorization: token abc123 458 459 {"values": {"HELLO": null}} 460 461 Example Response: 462 463 .. code-block:: console 464 465 HTTP/1.1 201 CREATED 466 Content-Type: application/json 467 X-Deis-Release: 4 468 469 { 470 "owner": "test", 471 "app": "example-go", 472 "values": { 473 "DEIS_APP": "example-go", 474 "DEIS_RELEASE": "v4" 475 }, 476 "memory": {}, 477 "cpu": {}, 478 "tags": {}, 479 "created": "2014-01-01T00:00:00UTC", 480 "updated": "2014-01-01T00:00:00UTC", 481 "uuid": "de1bf5b5-4a72-4f94-a10c-d2a3741cdf75" 482 } 483 484 485 Domains 486 ------- 487 488 489 List Application Domains 490 ```````````````````````` 491 492 Example Request: 493 494 .. code-block:: console 495 496 GET /v1/apps/example-go/domains/ HTTP/1.1 497 Host: deis.example.com 498 Authorization: token abc123 499 500 Example Response: 501 502 .. code-block:: console 503 504 HTTP/1.1 200 OK 505 Content-Type: application/json 506 507 { 508 "count": 1, 509 "next": null, 510 "previous": null, 511 "results": [ 512 { 513 "app": "example-go", 514 "created": "2014-01-01T00:00:00UTC", 515 "domain": "example.example.com", 516 "owner": "test", 517 "updated": "2014-01-01T00:00:00UTC" 518 } 519 ] 520 } 521 522 523 Add Domain 524 `````````` 525 526 Example Request: 527 528 .. code-block:: console 529 530 POST /v1/apps/example-go/domains/ HTTP/1.1 531 Host: deis.example.com 532 Authorization: token abc123 533 534 {'domain': 'example.example.com'} 535 536 Example Response: 537 538 .. code-block:: console 539 540 HTTP/1.1 201 CREATED 541 Content-Type: application/json 542 543 { 544 "app": "example-go", 545 "created": "2014-01-01T00:00:00UTC", 546 "domain": "example.example.com", 547 "owner": "test", 548 "updated": "2014-01-01T00:00:00UTC" 549 } 550 551 552 553 Remove Domain 554 ````````````` 555 556 Example Request: 557 558 .. code-block:: console 559 560 DELETE /v1/apps/example-go/domains/example.example.com HTTP/1.1 561 Host: deis.example.com 562 Authorization: token abc123 563 564 Example Response: 565 566 .. code-block:: console 567 568 HTTP/1.1 204 NO CONTENT 569 570 571 Builds 572 ------ 573 574 575 List Application Builds 576 ``````````````````````` 577 578 Example Request: 579 580 .. code-block:: console 581 582 GET /v1/apps/example-go/builds/ HTTP/1.1 583 Host: deis.example.com 584 Authorization: token abc123 585 586 Example Response: 587 588 .. code-block:: console 589 590 HTTP/1.1 200 OK 591 Content-Type: application/json 592 593 { 594 "count": 1, 595 "next": null, 596 "previous": null, 597 "results": [ 598 { 599 "app": "example-go", 600 "created": "2014-01-01T00:00:00UTC", 601 "dockerfile": "FROM deis/slugrunner RUN mkdir -p /app WORKDIR /app ENTRYPOINT [\"/runner/init\"] ADD slug.tgz /app ENV GIT_SHA 060da68f654e75fac06dbedd1995d5f8ad9084db", 602 "image": "example-go", 603 "owner": "test", 604 "procfile": { 605 "web": "example-go" 606 }, 607 "sha": "060da68f", 608 "updated": "2014-01-01T00:00:00UTC", 609 "uuid": "de1bf5b5-4a72-4f94-a10c-d2a3741cdf75" 610 } 611 ] 612 } 613 614 615 Create Application Build 616 ```````````````````````` 617 618 Example Request: 619 620 .. code-block:: console 621 622 POST /v1/apps/example-go/builds/ HTTP/1.1 623 Host: deis.example.com 624 Content-Type: application/json 625 Authorization: token abc123 626 627 {"image": "deis/example-go:latest"} 628 629 Example Response: 630 631 .. code-block:: console 632 633 HTTP/1.1 201 CREATED 634 Content-Type: application/json 635 X-Deis-Release: 4 636 637 { 638 "app": "example-go", 639 "created": "2014-01-01T00:00:00UTC", 640 "dockerfile": "", 641 "image": "deis/example-go:latest", 642 "owner": "test", 643 "procfile": {}, 644 "sha": "", 645 "updated": "2014-01-01T00:00:00UTC", 646 "uuid": "de1bf5b5-4a72-4f94-a10c-d2a3741cdf75" 647 } 648 649 650 Releases 651 -------- 652 653 654 List Application Releases 655 ````````````````````````` 656 657 Example Request: 658 659 .. code-block:: console 660 661 GET /v1/apps/example-go/releases/ HTTP/1.1 662 Host: deis.example.com 663 Authorization: token abc123 664 665 Example Response: 666 667 .. code-block:: console 668 669 HTTP/1.1 200 OK 670 Content-Type: application/json 671 672 { 673 "count": 3, 674 "next": null, 675 "previous": null, 676 "results": [ 677 { 678 "app": "example-go", 679 "build": "202d8e4b-600e-4425-a85c-ffc7ea607f61", 680 "config": "ed637ceb-5d32-44bd-9406-d326a777a513", 681 "created": "2014-01-01T00:00:00UTC", 682 "owner": "test", 683 "summary": "test changed nothing", 684 "updated": "2014-01-01T00:00:00UTC", 685 "uuid": "de1bf5b5-4a72-4f94-a10c-d2a3741cdf75", 686 "version": 3 687 }, 688 { 689 "app": "example-go", 690 "build": "202d8e4b-600e-4425-a85c-ffc7ea607f61", 691 "config": "95bd6dea-1685-4f78-a03d-fd7270b058d1", 692 "created": "2014-01-01T00:00:00UTC", 693 "owner": "test", 694 "summary": "test deployed 060da68", 695 "updated": "2014-01-01T00:00:00UTC", 696 "uuid": "de1bf5b5-4a72-4f94-a10c-d2a3741cdf75", 697 "version": 2 698 }, 699 { 700 "app": "example-go", 701 "build": null, 702 "config": "95bd6dea-1685-4f78-a03d-fd7270b058d1", 703 "created": "2014-01-01T00:00:00UTC", 704 "owner": "test", 705 "summary": "test created initial release", 706 "updated": "2014-01-01T00:00:00UTC", 707 "uuid": "de1bf5b5-4a72-4f94-a10c-d2a3741cdf75", 708 "version": 1 709 } 710 ] 711 } 712 713 714 List Release Details 715 ```````````````````` 716 717 Example Request: 718 719 .. code-block:: console 720 721 GET /v1/apps/example-go/releases/v1/ HTTP/1.1 722 Host: deis.example.com 723 Authorization: token abc123 724 725 Example Response: 726 727 .. code-block:: console 728 729 HTTP/1.1 200 OK 730 Content-Type: application/json 731 732 { 733 "app": "example-go", 734 "build": null, 735 "config": "95bd6dea-1685-4f78-a03d-fd7270b058d1", 736 "created": "2014-01-01T00:00:00UTC", 737 "owner": "test", 738 "summary": "test created initial release", 739 "updated": "2014-01-01T00:00:00UTC", 740 "uuid": "de1bf5b5-4a72-4f94-a10c-d2a3741cdf75", 741 "version": 1 742 } 743 744 745 Rollback Release 746 ```````````````` 747 748 Example Request: 749 750 .. code-block:: console 751 752 POST /v1/apps/example-go/releases/rollback/ HTTP/1.1 753 Host: deis.example.com 754 Content-Type: application/json 755 Authorization: token abc123 756 757 {"version": 1} 758 759 Example Response: 760 761 .. code-block:: console 762 763 HTTP/1.1 201 CREATED 764 Content-Type: application/json 765 766 {"version": 5} 767 768 769 Keys 770 ---- 771 772 773 List Keys 774 ````````` 775 776 Example Request: 777 778 .. code-block:: console 779 780 GET /v1/keys/ HTTP/1.1 781 Host: deis.example.com 782 Authorization: token abc123 783 784 Example Response: 785 786 .. code-block:: console 787 788 { 789 "count": 1, 790 "next": null, 791 "previous": null, 792 "results": [ 793 { 794 "created": "2014-01-01T00:00:00UTC", 795 "id": "test@example.com", 796 "owner": "test", 797 "public": "ssh-rsa <...>", 798 "updated": "2014-01-01T00:00:00UTC", 799 "uuid": "de1bf5b5-4a72-4f94-a10c-d2a3741cdf75" 800 } 801 ] 802 } 803 804 805 Add Key to User 806 ``````````````` 807 808 Example Request: 809 810 .. code-block:: console 811 812 POST /v1/keys/ HTTP/1.1 813 Host: deis.example.com 814 Authorization: token abc123 815 816 { 817 "id": "example", 818 "public": "ssh-rsa <...>" 819 } 820 821 Example Response: 822 823 .. code-block:: console 824 825 HTTP/1.1 201 CREATED 826 Content-Type: application/json 827 828 { 829 "created": "2014-01-01T00:00:00UTC", 830 "id": "example", 831 "owner": "example", 832 "public": "ssh-rsa <...>", 833 "updated": "2014-01-01T00:00:00UTC", 834 "uuid": "de1bf5b5-4a72-4f94-a10c-d2a3741cdf75" 835 } 836 837 838 Remove Key from User 839 ```````````````````` 840 841 Example Request: 842 843 .. code-block:: console 844 845 DELETE /v1/keys/example HTTP/1.1 846 Host: deis.example.com 847 Authorization: token abc123 848 849 Example Response: 850 851 .. code-block:: console 852 853 HTTP/1.1 204 NO CONTENT 854 855 856 Permissions 857 ----------- 858 859 860 List Application Permissions 861 ```````````````````````````` 862 863 Example Request: 864 865 .. code-block:: console 866 867 GET /v1/apps/example-go/perms/ HTTP/1.1 868 Host: deis.example.com 869 Authorization: token abc123 870 871 Example Response: 872 873 .. code-block:: console 874 875 HTTP/1.1 200 OK 876 Content-Type: application/json 877 878 { 879 "users": [] 880 } 881 882 883 Create Application Permission 884 ````````````````````````````` 885 886 Example Request: 887 888 .. code-block:: console 889 890 POST /v1/apps/example-go/perms/ HTTP/1.1 891 Host: deis.example.com 892 Authorization: token abc123 893 894 {"username": "example"} 895 896 Example Response: 897 898 .. code-block:: console 899 900 HTTP/1.1 201 CREATED 901 902 903 Remove Application Permission 904 ````````````````````````````` 905 906 Example Request: 907 908 .. code-block:: console 909 910 POST /v1/apps/example-go/perms/example HTTP/1.1 911 Host: deis.example.com 912 Authorization: token abc123 913 914 Example Response: 915 916 .. code-block:: console 917 918 HTTP/1.1 204 NO CONTENT 919 920 Grant User Administrative Privileges 921 ```````````````````````````````````` 922 923 .. note:: 924 925 This command requires administrative privileges 926 927 Example Request: 928 929 .. code-block:: console 930 931 POST /v1/admin/perms HTTP/1.1 932 Host: deis.example.com 933 Authorization: token abc123 934 935 {"username": "example"} 936 937 Example Response: 938 939 .. code-block:: console 940 941 HTTP/1.1 201 CREATED