rest.rst 28 KB
Newer Older
1
REST API
2
========
3

4 5 6 7 8 9 10 11 12 13 14
Patchwork exposes a REST API to allow other systems and scripts to interact
with it. The basic service it offers is exposing a mailing-list used for
sending patches and review comments as high level objects: series, revisions
and patches.

**series**
    A collection of revisions. Series objects are created, along with an
    initial revision, when a set of patches are sent to a mailing-list,
    usually through |git send-email|. Series can evolve over time and gain new
    revisions as the work matures through reviews, testing and new iterations.

15
    More about series and revisions can be found in :ref:`submitting-patches`.
16 17 18 19 20 21 22 23

**revision**
    A collection of patches.

**patch**
    The usual collection of changes expressed as a diff_. With |git|, a patch
    also contains full commit metadata.

24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
API Patterns
------------

All the API entry points share common patterns to offer a coherent whole and
limit surprises when using the API.

Lists
~~~~~

Various entry points expose lists of objects. They all follow the same
structure:

.. code-block:: json

    {
        "count": 25,
        "next": "http://patchwork.example.com/api/1.0/series/?page=2",
        "previous": null,
        "results": [
            {
                "object": 0
            },
            {
                "object": 1
            },
            {
            },
            {
                "object": 19
            },
        ]
    }

Lists are paginated with 20 elements per page by default. ``count`` is the
total number of objects while ``next`` and ``previous`` will hold URLs to the
next and previous pages. It's possible to change the number of elements per
page with the ``perpage`` GET parameter, with a limit of 100 elements per page.
61

62 63 64 65 66
API Reference
-------------

API Metadata
~~~~~~~~~~~~
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89

.. http:get:: /api/1.0/

    Metadata about the API itself.

    .. sourcecode:: http

        GET /api/1.0/ HTTP/1.1
        Accept: application/json


    .. sourcecode:: http

        HTTP/1.1 200 OK
        Vary: Accept
        Content-Type: application/json

        {
            "revision": 0
        }

    :>json int revision: API revision. This can be used to ensure the server
                         supports a feature introduced from a specific revision.
90 91
                         The list of API revisions and the changes introduced
                         by each of them is documented in `API Revisions`_.
92 93 94


Projects
95
~~~~~~~~
96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165

A project is merely one of the projects defined for this patchwork instance.

.. http:get:: /api/1.0/projects/

    List of all projects.

    .. sourcecode:: http

        GET /api/1.0/projects/ HTTP/1.1
        Accept: application/json

    .. sourcecode:: http

        HTTP/1.1 200 OK
        Content-Type: application/json
        Vary: Accept
        Allow: GET, HEAD, OPTIONS

        {
            "count": 2,
            "next": null,
            "previous": null,
            "results": [
                {
                    "id": 2,
                    "name": "beignet",
                    "linkname": "beignet",
                    "listemail": "beignet@lists.freedesktop.org",
                    "web_url": "http://www.freedesktop.org/wiki/Software/Beignet/",
                    "scm_url": "git://anongit.freedesktop.org/git/beignet",
                    "webscm_url": "http://cgit.freedesktop.org/beignet/"
                },
                {
                    "id": 1,
                    "name": "Cairo",
                    "linkname": "cairo",
                    "listemail": "cairo@cairographics.org",
                    "web_url": "http://www.cairographics.org/",
                    "scm_url": "git://anongit.freedesktop.org/git/cairo",
                    "webscm_url": "http://cgit.freedesktop.org/cairo/"
                }
            ]
        }

.. http:get:: /api/1.0/projects/(string: linkname)/
.. http:get:: /api/1.0/projects/(int: project_id)/

    .. sourcecode:: http

        GET /api/1.0/projects/intel-gfx/ HTTP/1.1
        Accept: application/json

    .. sourcecode:: http

        HTTP/1.1 200 OK
        Content-Type: application/json
        Vary: Accept
        Allow: GET, HEAD, OPTIONS

        {
            "id": 1,
            "name": "intel-gfx",
            "linkname": "intel-gfx",
            "listemail": "intel-gfx@lists.freedesktop.org",
            "web_url": "",
            "scm_url": "",
            "webscm_url": ""
        }

166 167
.. _rest-events:

168
Events
169
~~~~~~
170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189

.. http:get:: /api/1.0/projects/(string: linkname)/events/
.. http:get:: /api/1.0/projects/(int: project_id)/events/

    List of events for this project.

    .. sourcecode:: http

        GET /api/1.0/projects/intel-gfx/events/ HTTP/1.1
        Accept: application/json

    .. sourcecode:: http

        HTTP/1.1 200 OK
        Content-Type: application/json
        Vary: Accept
        Allow: GET, HEAD, OPTIONS

        {
            "count": 23,
190
            "next": "http://patchwork.example.com/api/1.0/events/?page=2",
191 192 193 194
            "previous": null,
            "results": [
                {
                    "name": "series-new-revision",
195
                    "event_time": "2015-10-20T19:49:49.494183",
196
                    "series": 23,
197
                    "patch": null,
198 199 200 201
                    "user": null,
                    "parameters": {
                        "revision": 2
                    }
202
                },
203 204
                {
                },
205
                {
206 207 208 209 210
                    "name": "patch-state-change",
                    "event_time": "2016-02-18T09:30:33.853206",
                    "series": 285,
                    "patch": 685
                    "user": 1,
211
                    "parameters": {
212 213
                        "new_state": "Under Review",
                        "previous_state": "New"
214
                    }
215 216 217 218 219 220 221 222 223 224
                },
                {
                    "name": "pull-request-new",
                    "event_time": "2016-02-16T07:22:20.753101",
                    "series": null,
                    "patch": 682
                    "user": null,
                    "parameters": {
                        "pull_url": "git://foo.bar/baz.git master"
                    }
225 226 227 228
                }
            ]
        }

229 230 231 232 233 234
    :query since: Retrieve only events newer than a specific time. Format is
                  the same as ``event_time`` in response, an ISO 8601 date. That
                  means that the ``event_time`` from the last seen event can
                  be used in the next query with a ``since`` parameter to only
                  retrieve events that haven't been seen yet.

235 236 237
    :query name: Filter the events by name. This field is a comma separated
                 list of events names.

238 239 240 241
    :query series: Filter the events by series id.

    :query patch: Filter the events by patch id.

242
Each event type has some ``parameters`` specific to that event. At the moment,
243
two events are possible:
244

245 246 247
- **series-new-revision**: This event corresponds to patchwork receiving a new
  revision of a series, should it be the initial submission or subsequent
  updates. The difference can be made by looking at the version of the series.
248

249
  This event only appears when patchwork has received the full set of mails
250 251 252 253 254 255 256
  belonging to the same series, so the revision object is guaranteed to
  contain all patches.

  **revision**: The version of the new revision that has been created.
  ``series`` and ``revision`` can be used to retrieve the corresponding
  patches.

257 258 259
- **patch-state-change**: This event corresponds to patchwork receiving a
  patch state change, either automatic or manually performed by an authorized
  user, who will be identified by its patchwork-user id.
260

261
Series
262
~~~~~~
263 264

A series object represents a lists of patches sent to the mailing-list through
265
|git send-email|. It also includes all subsequent patches that are sent to
266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289
address review comments, both single patch and full new series.

A series has then ``n`` revisions, ``n`` going from ``1`` to ``version``.

.. http:get:: /api/1.0/projects/(string: linkname)/series/
.. http:get:: /api/1.0/projects/(int: project_id)/series/

    List of all Series belonging to a specific project. The project can be
    specified using either its ``linkname`` or ``id``.

    .. sourcecode:: http

        GET /api/1.0/projects/intel-gfx/series/ HTTP/1.1
        Accept: application/json

    .. sourcecode:: http

        HTTP/1.1 200 OK
        Content-Type: application/json
        Vary: Accept
        Allow: GET, HEAD, OPTIONS

        {
            "count": 59,
290
            "next": "http://patchwork.example.com/api/1.0/projects/intel-gfx/series/?page=2",
291 292 293 294 295 296 297 298 299
            "previous": null,
            "results": [
                {
                    "id": 3,
                    "project": 1,
                    "name": "drm/i915: Unwind partial VMA rebinding after failure in set-cache-level",
                    "n_patches": 1,
                    "submitter": 77,
                    "submitted": "2015-10-09T11:51:38",
300
                    "last_updated": "2015-10-09T11:51:59.013345",
301
                    "version": 1,
302 303 304 305 306 307 308 309 310 311
                    "reviewer": null,
                    "test_state": null,
                    "state": "initial",
                    "state_summary": [
                        {
                            "count": 1,
                            "name": "New",
                            "final": false
                        }
                    ]
312 313 314 315 316 317 318 319
                },
                {
                    "id": 5,
                    "project": 1,
                    "name": "RFC drm/i915: Stop the machine whilst capturing the GPU crash dump",
                    "n_patches": 1,
                    "submitter": 77,
                    "submitted": "2015-10-09T12:21:45",
320
                    "last_updated": "2015-10-09T12:21:58.657976",
321 322
                    "version": 1,
                    "reviewer": null,
323 324 325 326 327 328 329 330 331
                    "test_state": null,
                    "state": "initial",
                    "state_summary": [
                        {
                            "count": 1,
                            "name": "New",
                            "final": false
                        }
                    ]
332 333 334 335
                }
            ]
        }

336 337 338 339 340 341 342 343 344 345
    :>json state: The state of the series. One of ``initial``,
                  ``in progress``, ``done`` or ``incomplete``.

    :>json state_summary: A summary of the patch status in the more recent
                          revision of the series. This a a list of objects
                          containing the number of patches (``count``) in a
                          given state (``name``). ``final`` is whether the
                          state is final or not, if a final decision (ie.
                          merged or rejected) has been made about a patch.

346 347
    :query project: Filter series by project ``id``.

348 349
    :query name: Filter series by name.

350 351 352
    :query submitter: Filter series by submitter ``id``. ``self`` can be used
                      as a special value meaning the current logged in user.

353 354 355
    :query reviewer: Filter series by reviewer ``id`` or ``null`` for no
                     reviewer assigned.

356
    :query submitted_since: Retrieve only submitted series newer than a
357
                            specified time. Format is the same as ``submitted``
358 359 360
                            in response, an ISO 8601 date.

    :query updated_since:   Retrieve only updated series newer than a
361
                            specified time. Format is the same as
362 363
                            ``last_updated`` in response, an ISO 8601 date.

364 365 366 367 368 369 370 371
    :query submitted_before: Retrieve only submitted series older than the
                             specified time. Format is the same as
                             ``submitted`` in response, an ISO 8601 date.

    :query updated_before:   Retrieve only updated series older than a
                             specified time. Format is the same as
                             ``last_updated`` in response, an ISO 8601 date.

372
    :query test_state: Filter series by test state. Possible values are
373 374
                       ``pending``, ``info``, ``success``, ``warning``,
                       ``failure`` or ``null`` series that don't have any test
375 376
                       result. It's also possible to give a comma separated
                       list of states.
377 378


379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395
.. http:get:: /api/1.0/series/

    List of all Series known to patchwork.

    .. sourcecode:: http

        GET /api/1.0/series/ HTTP/1.1
        Accept: application/json

    .. sourcecode:: http

        HTTP/1.1 200 OK
        Vary: Accept
        Content-Type: application/json

        {
            "count": 344,
396
            "next": "http://patchwork.example.com/api/1.0/series/?page=2",
397 398 399 400 401 402 403 404 405
            "previous": null,
            "results": [
                {
                    "id": 10,
                    "project": 1,
                    "name": "intel: New libdrm interface to create unbound wc user mappings for objects",
                    "n_patches": 1,
                    "submitter": 10,
                    "submitted": "2015-01-02T11:06:40",
406
                    "last_updated": "2015-10-09T07:55:18.608251",
407
                    "version": 1,
408 409 410 411 412 413 414 415 416 417
                    "reviewer": null,
                    "test_state": null,
                    "state": "initial",
                    "state_summary": [
                        {
                            "count": 1,
                            "name": "New",
                            "final": false
                        }
                    ]
418 419 420 421 422 423 424 425
                },
                {
                    "id": 1,
                    "project": 1,
                    "name": "PMIC based Panel and Backlight Control",
                    "n_patches": 4,
                    "submitter": 1,
                    "submitted": "2014-12-26T10:23:26",
426
                    "last_updated": "2015-10-09T07:55:01.558523",
427 428
                    "version": 1,
                    "reviewer": null,
429 430 431 432 433 434 435 436
                    "state": "initial",
                    "state_summary": [
                        {
                            "count": 4,
                            "name": "New",
                            "final": false
                        }
                    ]
437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462
                },
            ]
        }

.. http:get:: /api/1.0/series/(int: series_id)/

    A series (`series_id`). A Series object contains metadata about the series.

    .. sourcecode:: http

        GET /api/1.0/series/47/ HTTP/1.1
        Accept: application/json

    .. sourcecode:: http

        HTTP/1.1 200 OK
        Content-Type: application/json
        Vary: Accept
        Allow: GET, PUT, PATCH, HEAD, OPTIONS

        {
            "id": 47,
            "name": "Series without cover letter",
            "n_patches": 2,
            "submitter": 21,
            "submitted": "2015-01-13T09:32:24",
463
            "last_updated": "2015-10-09T07:57:23.541373",
464
            "version": 1,
465 466 467 468 469 470 471 472 473
            "reviewer": null,
            "state": "initial",
            "state_summary": [
                {
                    "count": 2,
                    "name": "New",
                    "final": false
                }
            ]
474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491
        }

.. http:get:: /api/1.0/series/(int: series_id)/revisions/

    The list of revisions of the series `series_id`.

    .. sourcecode:: http

        GET /api/1.0/series/47/revisions/ HTTP/1.1
        Accept: application/json

    .. sourcecode:: http

        HTTP/1.1 200 OK
        Content-Type: application/json
        Vary: Accept
        Allow: GET, HEAD, OPTIONS

492 493 494 495 496 497 498 499 500 501 502 503 504 505 506
        {
            "count": 1,
            "next": null,
            "previous": null,
            "results": [
                {
                    "version": 1,
                    "cover_letter": null,
                    "patches": [
                        120,
                        121
                    ]
                }
            ]
        }
507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532

.. http:get:: /api/1.0/series/(int: series_id)/revisions/(int: version)/

    The specific ``version`` of the series `series_id`.

    .. sourcecode:: http

        GET /api/1.0/series/47/revisions/1/ HTTP/1.1
        Accept: application/json

    .. sourcecode:: http

        HTTP/1.1 200 OK
        Content-Type: application/json
        Vary: Accept
        Allow: GET, HEAD, OPTIONS

        {
            "version": 1,
            "cover_letter": null,
            "patches": [
                120,
                121
            ]
        }

533 534 535 536 537 538
.. http:get:: /api/1.0/series/(int: series_id)/revisions/(int: version)/mbox/

    Retrieve an mbox file that will contain all patches of this revision, in
    order in which to apply them. This mbox file can be directly piped into
    ``git am``.

539 540 541 542
    :query link: Add an HTTP link to the Patchwork patch page in each commit
                 message. This link is preceded by a tag which name is given
                 as argument of this parameter, eg. ``?link=Patchwork``.

543 544
::

545
    $ curl -s http://patchwork.example.com/api/1.0/series/42/revisions/2/mbox/ | git am -3
546

547 548 549 550 551 552 553 554 555 556
.. http:get:: /api/1.0/series/(int: series_id)/revisions/(int: version)/mbox_with_cover/

    Retrieve an mbox file that will contain all patches of this revision,
    including cover letter. Cover letter presence makes this mbox unappliable by
    ``git am``.

    :query link: Add an HTTP link to the Patchwork patch page in each commit
                 message. This link is preceded by a tag which name is given
                 as argument of this parameter, eg. ``?link=Patchwork``.

557

558 559 560 561 562 563
.. http:post:: /api/1.0/series/(int: series_id)/revisions/(int: version)/test-results/

     Post test results for this revision.

    .. sourcecode:: http

564
        POST /api/1.0/series/47/revisions/1/test-results/ HTTP/1.1
565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592

        {
            "test_name": "checkpatch.pl",
            "state": "success",
            "url": "http://jenkins.example.com/logs/47/checkpatch.log",
            "summary": "total: 0 errors, 0 warnings, 10 lines checked"
        }

    :<json test_name: Required. The name of the test we're reporting results
                      for. This uniquely identifies the test. Any subsequent
                      data sent through this entry point with the same
                      ``test_name`` will be conflated into the same object.
                      It's thus possible to create a test result with a
                      ``pending`` state when a CI system picks up patches to
                      indicate testing has started and then update the result
                      with the final (``state``, ``url``, ``summary``) when
                      finished.
    :<json state: Required. State of the test results. One of ``pending``,
                  ``success``, ``warning`` or ``failure``
    :<json url: Optional. A URL where to find the detailed logs of the test
                run.
    :<json summary: Optional. A summary with some details about the results.
                    If set, this will be displayed along with the test result
                    to provide some detailed about the failure. It's suggested
                    to use ``summary`` for something short while ``url`` can
                    be used for full logs, which can be rather large.


593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621
.. http:get:: /api/1.0/series/(int: series_id)/revisions/(int: version)/test-results/

     Get test results for this revision.

    .. sourcecode:: http

        GET /api/1.0/series/47/revisions/1/test-results/ HTTP/1.1

        [
         {
             "date": "2017-08-09T23:00:03.529",
             "state": "pending",
             "summary": "total: 0 errors, 0 warnings, 10 lines checked"
             "test_name": "checkpatch.pl",
             "url": "http://jenkins.example.com/logs/47/checkpatch.log"
         },
         {
             "date": "2017-08-09T23:00:05.551",
             "state": "warning",
             "summary": "total: 0 errors, 2 warnings, 20 passes"
             "test_name": "BAT",
             "url": "http://jenkins.example.com/logs/47/BAT.log"
         }
        ]


    :<json date: Date when the results were posted to the patchwork (ISO 8061).


622 623 624 625 626 627 628
.. http:post /api/1.0/series/(int: series_id)/revisions/(int: version)/newrevision/

    Create a new ``series-new-revision`` event for this revision. This can be
    used to re-trigger testing on the series as CI systems listen for those
    events.


629
Patches
630
~~~~~~~
631

632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677
.. http:get:: /api/1.0/projects/(string: linkname)/patches/
.. http:get:: /api/1.0/projects/(int: project_id)/patches/

    List of all patches belonging to a specific project. The project can be
    specified using either its ``linkname`` or ``id``.

    .. sourcecode:: http

        GET /api/1.0/projects/intel-gfx/patches/ HTTP/1.1
        Accept: application/json

    .. sourcecode:: http

        HTTP/1.1 200 OK
        Content-Type: application/json
        Vary: Accept
        Allow: GET, HEAD, OPTIONS

        {
            "count": 1392,
            "next": "http://patchwork.example.com/api/1.0/projects/intel-gfx/patches/?page=2",
            "previous": null,
            "results": [
                {
                    "id": 1,
                    "project": 1,
                    "name": "[RFC,1/4] drm/i915: Define a common data structure for Panel Info",
                    "date": "2014-12-26T10:23:27",
                    "last_updated": "2014-12-26T10:23:27",
                    "submitter": 1,
                    "state": 1,
                    "content": "<diff content>"
                },
                {
                    "id": 4,
                    "project": 1,
                    "name": "[RFC,2/4] drm/i915: Add a drm_panel over INTEL_SOC_PMIC",
                    "date": "2014-12-26T10:23:28",
                    "last_updated": "2014-12-26T10:23:28",
                    "submitter": 1,
                    "state": 1,
                    "content": "<diff content>"
                }
            ]
        }

678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700
    :query project: Filter patches by project ``id``.

    :query name: Filter patches by name.

    :query submitter: Filter patches by submitter ``id``. ``self`` can be used
                      as a special value meaning the current logged in user.

    :query submitted_since: Retrieve only submitted patches newer than a
                            specified time. Format is the same as ``date``
                            in response, an ISO 8601 date.

    :query updated_since:   Retrieve only updated patches newer than a
                            specified time. Format is the same as
                            ``last_updated`` in response, an ISO 8601 date.

    :query submitted_before: Retrieve only submitted patches older than the
                             specified time. Format is the same as
                             ``date`` in response, an ISO 8601 date.

    :query updated_before:   Retrieve only updated patches older than a
                             specified time. Format is the same as
                             ``last_updated`` in response, an ISO 8601 date.

701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718
.. http:get:: /api/1.0/patches/

    List of all patches.

    .. sourcecode:: http

        GET /api/1.0/patches/ HTTP/1.1
        Accept: application/json

    .. sourcecode:: http

        HTTP/1.1 200 OK
        Content-Type: application/json
        Vary: Accept
        Allow: GET, HEAD, OPTIONS

        {
            "count": 1392,
719
            "next": "http://patchwork.example.com/api/1.0/patches/?page=2",
720 721 722 723 724 725 726
            "previous": null,
            "results": [
                {
                    "id": 1,
                    "project": 1,
                    "name": "[RFC,1/4] drm/i915: Define a common data structure for Panel Info",
                    "date": "2014-12-26T10:23:27",
727
                    "last_updated": "2014-12-26T10:23:27",
728 729 730 731 732 733 734 735 736
                    "submitter": 1,
                    "state": 1,
                    "content": "<diff content>"
                },
                {
                    "id": 4,
                    "project": 1,
                    "name": "[RFC,2/4] drm/i915: Add a drm_panel over INTEL_SOC_PMIC",
                    "date": "2014-12-26T10:23:28",
737
                    "last_updated": "2014-12-26T10:23:28",
738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764
                    "submitter": 1,
                    "state": 1,
                    "content": "<diff content>"
                }
            ]
        }

.. http:get:: /api/1.0/patches/(int: patch_id)/

    A specific patch.

    .. sourcecode:: http

        GET /api/1.0/patches/120/ HTTP/1.1
        Accept: application/json

    .. sourcecode:: http

            HTTP/1.1 200 OK
            Content-Type: application/json
            Vary: Accept
            Allow: GET, HEAD, OPTIONS

            {
                "id": 120,
                "name": "[1/2] drm/i915: Balance context pinning on reset cleanup",
                "date": "2015-01-13T09:32:24",
765
                "last_updated": "2015-01-13T09:32:24",
766 767 768 769 770
                "submitter": 21,
                "state": 1,
                "content": "<diff content>"
            }

771 772 773 774
.. http:get:: /api/1.0/patches/(int: patch_id)/mbox/

    Retrieve an mbox file. This mbox file can be directly piped into ``git am``.

775 776 777 778
    :query link: Add an HTTP link to the Patchwork patch page in the commit
                 message. This link is preceded by a tag which name is given
                 as argument of this parameter, eg. ``?link=Patchwork``.

779 780
::

781
    $ curl -s http://patchwork.example.com/api/1.0/patches/42/mbox/ | git am -3
782

783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829
Message-Id Lookup
~~~~~~~~~~~~~~~~~

.. http:get:: /api/1.0/msgids/(string: msgid)/

    List series containing patches/cover letter with given Message-Id. If the
    Message-Id resolves to a patch (instead of a cover letter) the ``patch_id``
    of that patch is also provided. Additionaly ``project_id`` of the series and
    list of revisions containing the patch/cover letter are always provided.
    ``msgid`` can be supplied either with or without less-than and greater-than
    sings, i.e. both ``<msg@id>`` and ``msg@id`` are accepted.

    This endpoint is never paginated.

    .. sourcecode:: http

        GET /api/1.0/msgids/<msg@id>/ HTTP/1.1
        Accept: application/json

    .. sourcecode:: http

        HTTP/1.1 200 OK
        Content-Type: application/json
        Vary: Accept
        Allow: GET, HEAD, OPTIONS

        {
            "count": 2,
            "next": null,
            "previous": null,
            "results": [
                {
                    "patch_id": 112227,
                    "project_id": 9,
                    "series_id": 12938,
                    "revision_ids": [ 1 ]
                },
                {
                    "patch_id": 112229,
                    "project_id": 18,
                    "series_id": 12937,
                    "revision_ids": [ 1 ]
                }
            ]
        }


830
API Revisions
831
-------------
832

833 834 835 836 837 838
**Revision 4**

- Add Msg-Id Lookup entry point:

   - /api/1.0/msgids/${msgid}/

839 840 841 842 843
**Revision 3**

- Add test results entry points:

  - /series/${id}/revisions/${version}/test-results/
844
  - /series/${id}/revisions/${version}/newrevision/
845

846 847 848
- Add the `project`, `name`, `submitter`, `reviewer`, `submitted_since`,
  `updated_since`, `submitted_before`, `updated_before` and `test_state` query
  parameters to the list of series entry points.
849

850 851
- Add the `test_state`, `state` and `test_summary` series fields.

852 853
- Add the patch-state-change event.

854 855
- Add the `name` query parameter to the /events/ entry point.

856 857
**Revision 2**

858 859
- Add mbox entry points for both patches and series:

860 861 862
  - /patches/${id}/mbox/
  - /series/${id}/revisions/${version}/mbox/

863 864
- Add a ``parameters`` field to events and include the revision number to the
  ``series-new-revision`` event.
865 866
- Change /series/${id}/revisions/ to follow the same list system as other
  entry points. This is technically an API change, but the impact is limited
867
  at this early point. Hopefully no one will ever find out.
868
- Document how lists of objects work.
869 870
- Make all DateTime field serialize to ISO 8061 format and not the ECMA 262
  subset.
871 872
- Add ``since``, ``name``, ``series`` and ``patch`` GET parameters to
  /projects/${id,linkname}/events/
873

Damien Lespiau's avatar
Damien Lespiau committed
874 875 876 877
**Revision 1**

- Add /projects/${linkname}/events/ entry point.

878 879 880 881
**Revision 0**

- Initial revision. Basic objects exposed: api root, projects, series,
  revisions and patches.
882 883

.. include:: symbols