LibraryOfCongress / api.congress.gov

congress.gov API
601 stars 38 forks source link

(house-communication): sort by `updateDate` #217

Open ryparker opened 3 months ago

ryparker commented 3 months ago

The house-communication list API currently returns items that are not in any particular order (that I recognize). It would be ideal if there was a sort option, but at the least it would be helpful for caching purposes if all list APIs sorted by updateDate.

e.g.

curl --location 'https://api.congress.gov/v3/house-communication/118?format=json&api_key=<API_KEY>'

Response:

{
    "houseCommunications": [
        {
            "chamber": "House",
            "communicationType": {
                "code": "EC",
                "name": "Executive Communication"
            },
            "congress": 118,
            "number": 2321,
            "updateDate": "2023-11-07",
            "url": "https://api.congress.gov/v3/house-communication/118/ec/2321?format=json"
        },
        {
            "chamber": "House",
            "communicationType": {
                "code": "EC",
                "name": "Executive Communication"
            },
            "congress": 118,
            "number": 1062,
            "updateDate": "2023-06-06",
            "url": "https://api.congress.gov/v3/house-communication/118/ec/1062?format=json"
        },
        {
            "chamber": "House",
            "communicationType": {
                "code": "EC",
                "name": "Executive Communication"
            },
            "congress": 118,
            "number": 418,
            "updateDate": "2023-02-18",
            "url": "https://api.congress.gov/v3/house-communication/118/ec/418?format=json"
        },
        {
            "chamber": "House",
            "communicationType": {
                "code": "EC",
                "name": "Executive Communication"
            },
            "congress": 118,
            "number": 2293,
            "updateDate": "2023-11-04",
            "url": "https://api.congress.gov/v3/house-communication/118/ec/2293?format=json"
        },
        {
            "chamber": "House",
            "communicationType": {
                "code": "EC",
                "name": "Executive Communication"
            },
            "congress": 118,
            "number": 2294,
            "updateDate": "2023-11-04",
            "url": "https://api.congress.gov/v3/house-communication/118/ec/2294?format=json"
        },
        {
            "chamber": "House",
            "communicationType": {
                "code": "EC",
                "name": "Executive Communication"
            },
            "congress": 118,
            "number": 417,
            "updateDate": "2023-02-18",
            "url": "https://api.congress.gov/v3/house-communication/118/ec/417?format=json"
        },
        {
            "chamber": "House",
            "communicationType": {
                "code": "EC",
                "name": "Executive Communication"
            },
            "congress": 118,
            "number": 425,
            "updateDate": "2023-02-22",
            "url": "https://api.congress.gov/v3/house-communication/118/ec/425?format=json"
        },
        {
            "chamber": "House",
            "communicationType": {
                "code": "EC",
                "name": "Executive Communication"
            },
            "congress": 118,
            "number": 424,
            "updateDate": "2023-02-22",
            "url": "https://api.congress.gov/v3/house-communication/118/ec/424?format=json"
        },
        {
            "chamber": "House",
            "communicationType": {
                "code": "EC",
                "name": "Executive Communication"
            },
            "congress": 118,
            "number": 1397,
            "updateDate": "2023-07-14",
            "url": "https://api.congress.gov/v3/house-communication/118/ec/1397?format=json"
        },
        {
            "chamber": "House",
            "communicationType": {
                "code": "EC",
                "name": "Executive Communication"
            },
            "congress": 118,
            "number": 426,
            "updateDate": "2023-02-22",
            "url": "https://api.congress.gov/v3/house-communication/118/ec/426?format=json"
        },
        {
            "chamber": "House",
            "communicationType": {
                "code": "EC",
                "name": "Executive Communication"
            },
            "congress": 118,
            "number": 2327,
            "updateDate": "2023-11-07",
            "url": "https://api.congress.gov/v3/house-communication/118/ec/2327?format=json"
        },
        {
            "chamber": "House",
            "communicationType": {
                "code": "EC",
                "name": "Executive Communication"
            },
            "congress": 118,
            "number": 427,
            "updateDate": "2023-02-22",
            "url": "https://api.congress.gov/v3/house-communication/118/ec/427?format=json"
        },
        {
            "chamber": "House",
            "communicationType": {
                "code": "EC",
                "name": "Executive Communication"
            },
            "congress": 118,
            "number": 2328,
            "updateDate": "2023-11-07",
            "url": "https://api.congress.gov/v3/house-communication/118/ec/2328?format=json"
        },
        {
            "chamber": "House",
            "communicationType": {
                "code": "EC",
                "name": "Executive Communication"
            },
            "congress": 118,
            "number": 1118,
            "updateDate": "2023-06-08",
            "url": "https://api.congress.gov/v3/house-communication/118/ec/1118?format=json"
        },
        {
            "chamber": "House",
            "communicationType": {
                "code": "EC",
                "name": "Executive Communication"
            },
            "congress": 118,
            "number": 1499,
            "updateDate": "2023-07-28",
            "url": "https://api.congress.gov/v3/house-communication/118/ec/1499?format=json"
        },
        {
            "chamber": "House",
            "communicationType": {
                "code": "EC",
                "name": "Executive Communication"
            },
            "congress": 118,
            "number": 2329,
            "updateDate": "2023-11-07",
            "url": "https://api.congress.gov/v3/house-communication/118/ec/2329?format=json"
        },
        {
            "chamber": "House",
            "communicationType": {
                "code": "EC",
                "name": "Executive Communication"
            },
            "congress": 118,
            "number": 1429,
            "updateDate": "2023-07-25",
            "url": "https://api.congress.gov/v3/house-communication/118/ec/1429?format=json"
        },
        {
            "chamber": "House",
            "communicationType": {
                "code": "EC",
                "name": "Executive Communication"
            },
            "congress": 118,
            "number": 812,
            "updateDate": "2023-04-28",
            "url": "https://api.congress.gov/v3/house-communication/118/ec/812?format=json"
        },
        {
            "chamber": "House",
            "communicationType": {
                "code": "EC",
                "name": "Executive Communication"
            },
            "congress": 118,
            "number": 813,
            "updateDate": "2023-04-28",
            "url": "https://api.congress.gov/v3/house-communication/118/ec/813?format=json"
        },
        {
            "chamber": "House",
            "communicationType": {
                "code": "EC",
                "name": "Executive Communication"
            },
            "congress": 118,
            "number": 2330,
            "updateDate": "2023-11-07",
            "url": "https://api.congress.gov/v3/house-communication/118/ec/2330?format=json"
        }
    ],
    "pagination": {
        "count": 3696,
        "next": "https://api.congress.gov/v3/house-communication/118?offset=20&limit=20&format=json"
    },
    "request": {
        "congress": "118",
        "contentType": "application/json",
        "format": "json"
    }
}

This is also true for all the filter endpoints: