USDepartmentofLabor / Developer

Developer.dol.gov
6 stars 6 forks source link

Getting "Not Acceptable. Check suggested format." errors from V2 API. #137

Open davidkellerman opened 5 years ago

davidkellerman commented 5 years ago

This command is getting a "Not Acceptable. Check suggested format." error:

curl -H "X-API-KEY: ..." \
   https://data.dol.gov/get/inspection/format/json/limit/200/date_column/case_mod_date/start_date/2012-01-01

I also tried a bunch of variants, trimming out filtering options, all with the same result.

As a reality check, I also tried the examples at the bottom of the ACCESSING THE API USING HTTP REQUESTS page:

curl -H "X-API-KEY: ..." \
  https://data.dol.gov/get/accident/format/xml/limit/10/offset/5/columns/summary_nr:event_desc:event_time
curl -k -H "X-API-KEY: ..." \
  https://data.dol.gov/get/accident/limit/130/filter_column/event_keyword=crushed:report_id=04547

They, too, get the same "Not Acceptable. Check suggested format." error.

Help! I'm baffled.

giridhar commented 5 years ago

The inspection data should be working now. we are working with the database team to fix the accident dataset issues.

davidkellerman commented 5 years ago

Hmm. I wonder if there's more than one problem. I'm still getting the same error with the get/inspection request.

dklemish commented 5 years ago

I just came across the same error as @davidkellerman, at least with regards to the accident table. It looks like the API calls to the accident table are actually being routed to the accident abstract table.

For example, using the example from the API documentation: curl -k -H "X-API-KEY: ..." https://data.dol.gov/get/accident/format/json/limit/1/offset/5/columns/summary_nr:event_desc:event_time gives the error "Not Acceptable. Check suggested format." However, if I drop the filtering requests curl -k -H "X-API-KEY: ..." https://data.dol.gov/get/accident/format/json/limit/1/offset/5 I get back a valid response:

{ "SUMMARY_NR": "220965826", "LINE_NR": "2", "ABSTRACT_TEXT": "in a ship\u0019s hull. The employee became overheated while working within the ", "LOAD_DT": "26-MAR-18 03.59.55.000000 PM -04:00", "RNUM": "6" }

This is the record format for the accident abstract table. This explains why the request filtering on columns doesn't work as these columns don't exist in the abstract table.

jvarugh commented 4 years ago

Any update on this request? Still seems to be an issue for inspections.

giridhar commented 4 years ago

@jvarugh just wanted to confirm if you are enquiring about filtering by date or date_column filter?

jvarugh commented 4 years ago

@giridhar

Both I guess. I'm running a very similar request to the OP.

GET Request: https://data.dol.gov/get/inspection/limit/200/offset/0/date_column/open_date/start_date/2020-01-01

GET Response::

{ "status": "0", "error": "Not Acceptable. Check suggested format." }

Seems like no matter what date_column value (open_date in this case), the response is always the same.

I am using the documentation here: https://developer.dol.gov/accessing-the-apis-using-http-requests/#apiv2

giridhar commented 4 years ago

@jvarugh We are aware of date filters not working as desired and we are diligently working on an improvement of API capabilities. While it is not ideal, you may leverage other filters to limit results and then filter by date outside of the API call once you have the full set of data. As these capabilities are ready for release, announcements will be posted via our developer website. Thank you.

jvarugh commented 4 years ago

@giridhar

That is our current workaround, but that requires us to pull 4 million+ records (which took several days) to obtain only ~30,000 for 2020, or ~400K since 2015.

Will you update this ticket when there is a fix for this?

The website/DOL subscriptions are for all things DOL related, not specifically API related.

Thanks,

mludeiro commented 3 years ago

The issue is that, despite of the documentation, this column is a string, not a date try with /filter_column/CASE_MOD_DATE=10-DEC-13 to get that specific date