My students and I are trying to access child labor statistics data from the Sweat and Toil dataset, with the endpoints as described on https://developer.dol.gov/others/sweat-and-toil/, and using the format as described at https://developer.dol.gov/beginners-guide/#apiv2.

When trying (in Python) to do so with code like the following:

response = requests.get("https://data.dol.gov/SweatToilAllStatistics", headers={'X-API-KEY': 'KEYREMOVED'})

we get a 404. For some other data sets in Sweat and Toil (and other v2 datasets we've tried), we get a 403 with the following response:

    "status": "",
    "error": "Invalid API Key"

But when I use this exact same API key on some v1 API datasets, e.g.,

response = requests.get("http://api.dol.gov/V1/DOLAgency/Agencies/?KEY=KEYREMOVED") 

it works fine, so I actually don't think "Invalid API Key" is the true issue here. The same issue occurs when attempting this with curl. Any help anyone might be able to offer would be much appreciated. Thanks so much!

  • For the first one, I think you're missing a /get/: data.dol.gov/get/SweatToilAllStatistics gives me an invalid API key (because I don't have one), but not a 404 file not found. – user3856 Nov 14 '19 at 3:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.