Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

/api/v2/subawards/ does not respect Content-Type header #4164

Open
Ech0riginal opened this issue Aug 19, 2024 · 0 comments
Open

/api/v2/subawards/ does not respect Content-Type header #4164

Ech0riginal opened this issue Aug 19, 2024 · 0 comments

Comments

@Ech0riginal
Copy link

Ech0riginal commented Aug 19, 2024

The/api/v2/subawards/ route does not respect the Content-Type header. It will only accept requests with a content type header of application/x-www-form-urlencoded, regardless of the actual content. Disregarding this header will result in a default empty value akin to:
{"page_metadata":{"page":1,"next":null,"previous":1,"hasNext":false,"hasPrevious":true},"results":[]}

To be clear: if you do not use this header while maintaining the interface detailed in api_contracts/contracts/v2/subawards.md the request is seemingly rejected outright.

Example using the incorrect header:

curl 'https://api.usaspending.gov/api/v2/subawards/' \
  -X POST \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/x-www-form-urlencoded' \
  -d '{ 
        "page": 1,
        "limit": 10,
        "sort": "subaward_number",
        "order": "asc",
        "award_id": "W56KGU21C0050"
      }'

Returns:

{
  "page_metadata": {
    "page": 1,
    "next": 2,
    "previous": null,
    "hasNext": true,
    "hasPrevious": false
  },
  "results": [
    {
      "id": 148401622,
      "subaward_number": "\u00a0\u00a0DLPH050233",
      "description": "PAINT ABATEMENT \u00a0LABOR",
      "action_date": "2017-04-20",
      "amount": 52260.0,
      "recipient_name": "IMIA, LLC"
    },
    {
      "id": 154994152,
      "subaward_number": "\u00a0MAKSPH-001-18",
      "description": "SUPPORTED THE SCALING OFF-GRID ENERGY (SOGE) OFF-GRID SOLAR HOME SYSTEMS AND STORAGE TECHNOLOGY MARKET ASSESSMENTS",
      "action_date": "2018-06-01",
      "amount": 72025.0,
      "recipient_name": "REGENTS OF THE UNIVERSITY OF CALIFORNIA, THE"
    },
    {
      "id": 148595490,
      "subaward_number": "\u00a0DLPH050607",
      "description": "SCAFFFOLDING",
      "action_date": "2017-05-09",
      "amount": 32493.0,
      "recipient_name": "TURN KEY SCAFFOLD LLC"
    },
    {
      "id": 149488398,
      "subaward_number": "\u00a0DLPH050232",
      "description": "CONTROLS ENGINEER - LABOR",
      "action_date": "2017-04-17",
      "amount": 49035.2,
      "recipient_name": "AEROTEK AFFILIATED SERVICES, INC."
    },
    {
      "id": 152602401,
      "subaward_number": "\u00a0ASUB00000454",
      "description": "PREPARING RESEARCHERS IN EARLY INTERVENTION FOR CHILDREN WITH DISABILITIES FROM MULTICULTURAL ENVIRONMENTS",
      "action_date": "2020-01-14",
      "amount": 234778.0,
      "recipient_name": "UNIVERSITY OF ARIZONA"
    },
    {
      "id": 149918994,
      "subaward_number": "ZZEMSP02",
      "description": "TO PROVIDE FINANCIAL ASSISTANCE IN MEETING THE TRANSPORTATION NEEDS OF SENIORS AND INDIVIDUALS WITH DISABILITIES WHERE PUBLIC TRANSPORTATION SERVICES ARE UNAVAILABLE, INSUFFICIENT OR INAPPROPRIATE. THE SECTION 5310 PROGRAM IS DESIGNED TO SUPPLEMENT FTA'S OTHER CAPITAL ASSISTANCE PROGRAMS BY FUNDING TRANSPORTATION PROJECTS FOR SENIORS AND INDIVIDUALS WITH DISABILITIES IN ALL AREAS - URBANIZED, SMALL URBAN, AND RURAL. THE PROGRAM INCLUDES NEW FREEDOM PROGRAM ACTIVITIES AS ELIGIBLE PROJECTS.",
      "action_date": "2021-09-23",
      "amount": 54115.0,
      "recipient_name": "EAST TENNESSEE HUMAN RESOURCE AGENCY, INC."
    },
    {
      "id": 151427852,
      "subaward_number": "ZZ8-K45",
      "description": "SUPPORT THE OBJECTIVES AND DELIVERABLES OF DE-FE0032131. THE FRONT END ENGINEERING DESIGN STUDY AND PUBLIC POLICY CONSIDERATIONS",
      "action_date": "2022-02-11",
      "amount": 228913.0,
      "recipient_name": "SOUTHERN COMPANY SERVICES, INC."
    },
    {
      "id": 150144222,
      "subaward_number": "ZZ-42-580",
      "description": "CAREER AND TECHNICAL EDUCATION -- BASIC GRANTS",
      "action_date": "2012-07-01",
      "amount": 19245.0,
      "recipient_name": "MARION COUNTY SCHOOL DISTRICT"
    },
    {
      "id": 150236946,
      "subaward_number": "ZZ2THS144",
      "description": "ENFORCEMENT OF TN DUI LAWS",
      "action_date": "2022-01-14",
      "amount": 36600.0,
      "recipient_name": "CITY OF JOHNSON CITY"
    },
    {
      "id": 150029039,
      "subaward_number": "ZZ2THS005",
      "description": "CHOICES MATTER",
      "action_date": "2021-12-29",
      "amount": 50000.0,
      "recipient_name": "ALLIANCE SPORT MARKETING LLC"
    }
  ]
}

Example using the correct header:

curl 'https://api.usaspending.gov/api/v2/subawards/' \
  -X POST \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{ 
        "page": 1,
        "limit": 10,
        "sort": "subaward_number",
        "order": "asc",
        "award_id": "W56KGU21C0050"
      }'

Returns:

{
  "page_metadata": {
    "page": 1,
    "next": null,
    "previous": null,
    "hasNext": false,
    "hasPrevious": false
  },
  "results": []
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant