LibraryOfCongress / api.congress.gov

congress.gov API
601 stars 38 forks source link

(amendment): sort by `updateDate` #228

Open ryparker opened 2 months ago

ryparker commented 2 months ago

The amendment 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/amendment/118?format=json&api_key=<API_KEY>'

Response:

{
    "amendments": [
        {
            "congress": 118,
            "description": "An amendment numbered 6 printed in House Report 118-456 to modify the definition of electronic communication service provider under section 702.",
            "latestAction": {
                "actionDate": "2024-04-12",
                "actionTime": "12:50:08",
                "text": "On agreeing to the Turner amendment (A006) Agreed to by recorded vote: 236 - 186 (Roll no. 118)."
            },
            "number": "881",
            "type": "HAMDT",
            "updateDate": "2024-04-15T13:51:00Z",
            "url": "https://api.congress.gov/v3/amendment/118/hamdt/881?format=json"
        },
        {
            "congress": 118,
            "description": "An amendment numbered 5 printed in House Report 118-456 to enable the use of section 702 information to vet foreigners traveling to the United States.",
            "latestAction": {
                "actionDate": "2024-04-12",
                "actionTime": "12:44:55",
                "text": "On agreeing to the Waltz amendment (A005) Agreed to by recorded vote: 227 - 193 (Roll no. 117)."
            },
            "number": "880",
            "type": "HAMDT",
            "updateDate": "2024-04-15T13:49:50Z",
            "url": "https://api.congress.gov/v3/amendment/118/hamdt/880?format=json"
        },
        {
            "congress": 118,
            "description": "An amendment numbered 4 printed in House Report 118-456 to modify the definition of foreign intelligence under section 702.",
            "latestAction": {
                "actionDate": "2024-04-12",
                "actionTime": "12:41:25",
                "text": "On agreeing to the Crenshaw amendment (A004) Agreed to by recorded vote: 268 - 152 (Roll no. 116)."
            },
            "number": "879",
            "type": "HAMDT",
            "updateDate": "2024-04-15T13:48:34Z",
            "url": "https://api.congress.gov/v3/amendment/118/hamdt/879?format=json"
        },
        {
            "congress": 118,
            "description": "An amendment numbered 2 printed in House Report 118-456 to require the FBI to report to Congress on a quarterly basis the number of U.S. person queries conducted and permits Congressional leadership to attend Foreign Intelligence Surveillance Court proceedings.",
            "latestAction": {
                "actionDate": "2024-04-12",
                "actionTime": "12:37:43",
                "text": "On agreeing to the Roy amendment (A002) Agreed to by recorded vote: 269 - 153 (Roll no. 115)."
            },
            "number": "877",
            "type": "HAMDT",
            "updateDate": "2024-04-15T13:46:41Z",
            "url": "https://api.congress.gov/v3/amendment/118/hamdt/877?format=json"
        },
        {
            "congress": 118,
            "description": "An amendment numbered 1 printed in House Report 118-456 to prohibit warrantless searches of U.S. person communications in the FISA 702 database, with exceptions for imminent threats to life or bodily harm, consent searches, or known cybersecurity threat signatures.",
            "latestAction": {
                "actionDate": "2024-04-12",
                "actionTime": "12:32:12",
                "text": "On agreeing to the Biggs amendment (A001) Failed by recorded vote: 212 - 212 (Roll no. 114)."
            },
            "number": "876",
            "type": "HAMDT",
            "updateDate": "2024-04-15T13:45:40Z",
            "url": "https://api.congress.gov/v3/amendment/118/hamdt/876?format=json"
        },
        {
            "congress": 118,
            "description": "An amendment numbered 3 printed in House Report 118-456 to prohibit the resumption of \"abouts\" collection under section 702.",
            "latestAction": {
                "actionDate": "2024-04-12",
                "actionTime": "11:22:29",
                "text": "On agreeing to the Cline amendment (A003) Agreed to by voice vote."
            },
            "number": "878",
            "type": "HAMDT",
            "updateDate": "2024-04-15T13:47:34Z",
            "url": "https://api.congress.gov/v3/amendment/118/hamdt/878?format=json"
        },
        {
            "congress": 118,
            "latestAction": {
                "actionDate": "2024-03-23",
                "text": "Amendment SA 1818 agreed to in Senate by Unanimous Consent."
            },
            "number": "1818",
            "purpose": "In the nature of a substitute.",
            "type": "SAMDT",
            "updateDate": "2024-04-06T00:20:24Z",
            "url": "https://api.congress.gov/v3/amendment/118/samdt/1818?format=json"
        },
        {
            "congress": 118,
            "latestAction": {
                "actionDate": "2024-03-23",
                "text": "SA 1794 fell when SA 1793 fell."
            },
            "number": "1794",
            "purpose": "To add an effective date.",
            "type": "SAMDT",
            "updateDate": "2024-04-06T00:20:22Z",
            "url": "https://api.congress.gov/v3/amendment/118/samdt/1794?format=json"
        },
        {
            "congress": 118,
            "latestAction": {
                "actionDate": "2024-03-23",
                "text": "SA 1793 fell when SA 1792 was withdrawn."
            },
            "number": "1793",
            "purpose": "To add an effective date.",
            "type": "SAMDT",
            "updateDate": "2024-04-06T00:20:22Z",
            "url": "https://api.congress.gov/v3/amendment/118/samdt/1793?format=json"
        },
        {
            "congress": 118,
            "latestAction": {
                "actionDate": "2024-03-23",
                "text": "Proposed amendment SA 1792 withdrawn in Senate."
            },
            "number": "1792",
            "purpose": "To add an effective date.",
            "type": "SAMDT",
            "updateDate": "2024-04-06T00:20:22Z",
            "url": "https://api.congress.gov/v3/amendment/118/samdt/1792?format=json"
        },
        {
            "congress": 118,
            "latestAction": {
                "actionDate": "2024-03-23",
                "text": "SA 1791 fell when SA 1790 was withdrawn."
            },
            "number": "1791",
            "purpose": "To add an effective date.",
            "type": "SAMDT",
            "updateDate": "2024-04-06T00:20:22Z",
            "url": "https://api.congress.gov/v3/amendment/118/samdt/1791?format=json"
        },
        {
            "congress": 118,
            "latestAction": {
                "actionDate": "2024-03-23",
                "text": "Proposed amendment SA 1790 withdrawn in Senate."
            },
            "number": "1790",
            "purpose": "To add an effective date.",
            "type": "SAMDT",
            "updateDate": "2024-04-06T00:20:22Z",
            "url": "https://api.congress.gov/v3/amendment/118/samdt/1790?format=json"
        },
        {
            "congress": 118,
            "latestAction": {
                "actionDate": "2024-03-23",
                "text": "Amendment SA 1718 not agreed to in Senate by Voice Vote."
            },
            "number": "1718",
            "purpose": "To prohibit funding for the release of special interest aliens from Federal custody during such aliens' proceedings under the Immigration and Nationality Act.",
            "type": "SAMDT",
            "updateDate": "2024-04-06T00:20:17Z",
            "url": "https://api.congress.gov/v3/amendment/118/samdt/1718?format=json"
        },
        {
            "congress": 118,
            "latestAction": {
                "actionDate": "2024-03-23",
                "text": "Amendment SA 1713 not agreed to in Senate by Voice Vote."
            },
            "number": "1713",
            "purpose": "To prohibit the use of funds for the Women and Infants Hospital, Rhode Island.",
            "type": "SAMDT",
            "updateDate": "2024-04-06T00:20:16Z",
            "url": "https://api.congress.gov/v3/amendment/118/samdt/1713?format=json"
        },
        {
            "congress": 118,
            "latestAction": {
                "actionDate": "2024-03-23",
                "text": "Amendment SA 1706 proposed by Senator Johnson. (consideration: CR S2582) To prohibit the disbursement of certain Federal funding to local jurisdictions that refuse to provide advance notice to the Department of Homeland Security regarding the release of illegal aliens from local custody."
            },
            "number": "1706",
            "purpose": "To prohibit the disbursement of certain Federal funding to local jurisdictions that refuse to provide advance notice to the Department of Homeland Security regarding the release of illegal aliens from local custody.",
            "type": "SAMDT",
            "updateDate": "2024-04-06T00:20:16Z",
            "url": "https://api.congress.gov/v3/amendment/118/samdt/1706?format=json"
        },
        {
            "congress": 118,
            "latestAction": {
                "actionDate": "2024-03-23",
                "text": "Amendment SA 1795 not agreed to in Senate by Yea-Nay Vote. 47 - 51. Record Vote Number: 109."
            },
            "number": "1795",
            "purpose": "To prohibit the use of funds to label speech as disinformation or misinformation or to coerce online platforms to alter, remove, restrict, or suppress speech.",
            "type": "SAMDT",
            "updateDate": "2024-04-06T00:20:22Z",
            "url": "https://api.congress.gov/v3/amendment/118/samdt/1795?format=json"
        },
        {
            "congress": 118,
            "latestAction": {
                "actionDate": "2024-03-23",
                "text": "Amendment SA 1781 proposed by Senator Tuberville. (consideration: CR S2580-2581) To prohibit funding for entities that permit certain students to participate in girls' or women's athletics."
            },
            "number": "1781",
            "purpose": "To prohibit funding for entities that permit certain students to participate in girls' or women's athletics.",
            "type": "SAMDT",
            "updateDate": "2024-04-06T00:20:21Z",
            "url": "https://api.congress.gov/v3/amendment/118/samdt/1781?format=json"
        },
        {
            "congress": 118,
            "latestAction": {
                "actionDate": "2024-03-23",
                "text": "Amendment SA 1804 proposed by Senator Cruz. (consideration: CR S2580) To prohibit the use of funds to waive certain sanctions with respect to Iran."
            },
            "number": "1804",
            "purpose": "To prohibit the use of funds to waive certain sanctions with respect to Iran.",
            "type": "SAMDT",
            "updateDate": "2024-04-06T00:20:23Z",
            "url": "https://api.congress.gov/v3/amendment/118/samdt/1804?format=json"
        },
        {
            "congress": 118,
            "latestAction": {
                "actionDate": "2024-03-23",
                "text": "Amendment SA 1722 not agreed to in Senate by Yea-Nay Vote. 45 - 51. Record Vote Number: 105."
            },
            "number": "1722",
            "purpose": "To prohibit Federal funding for the use of the CBP One application to facilitate the entry of aliens into the United States.",
            "type": "SAMDT",
            "updateDate": "2024-04-06T00:20:17Z",
            "url": "https://api.congress.gov/v3/amendment/118/samdt/1722?format=json"
        },
        {
            "congress": 118,
            "description": "Pursuant to the provisions of H. Res. 1085, the amendment in the nature of a substitute consisting of the text of Rules Committee Print 118-26 is considered adopted.",
            "latestAction": {
                "actionDate": "2024-03-22",
                "text": "On agreeing to the Rules amendment (A001) Agreed to without objection."
            },
            "number": "875",
            "type": "HAMDT",
            "updateDate": "2024-03-23T08:16:14Z",
            "url": "https://api.congress.gov/v3/amendment/118/hamdt/875?format=json"
        }
    ],
    "pagination": {
        "count": 2699,
        "next": "https://api.congress.gov/v3/amendment/118?offset=20&limit=20&format=json"
    },
    "request": {
        "congress": "118",
        "contentType": "application/json",
        "format": "json"
    }
}

Notice how index 5's updateDate (2024-04-15T13:47:34Z) is after (more recent than) Index 4's updateDate (2024-04-15T13:45:40Z).:

{
            "congress": 118,
            "description": "An amendment numbered 1 printed in House Report 118-456 to prohibit warrantless searches of U.S. person communications in the FISA 702 database, with exceptions for imminent threats to life or bodily harm, consent searches, or known cybersecurity threat signatures.",
            "latestAction": {
                "actionDate": "2024-04-12",
                "actionTime": "12:32:12",
                "text": "On agreeing to the Biggs amendment (A001) Failed by recorded vote: 212 - 212 (Roll no. 114)."
            },
            "number": "876",
            "type": "HAMDT",
            "updateDate": "2024-04-15T13:45:40Z",
            "url": "https://api.congress.gov/v3/amendment/118/hamdt/876?format=json"
        },
        {
            "congress": 118,
            "description": "An amendment numbered 3 printed in House Report 118-456 to prohibit the resumption of \"abouts\" collection under section 702.",
            "latestAction": {
                "actionDate": "2024-04-12",
                "actionTime": "11:22:29",
                "text": "On agreeing to the Cline amendment (A003) Agreed to by voice vote."
            },
            "number": "878",
            "type": "HAMDT",
            "updateDate": "2024-04-15T13:47:34Z",
            "url": "https://api.congress.gov/v3/amendment/118/hamdt/878?format=json"
        },