Closed QJF3 closed 9 years ago
@QJF3 which agency are you with? Do you already have an account and organization in inventory.data.gov?
I am with the VA and when I try to access the API I am using my authorization key that is issued to me as an Inventory.Data.Gov user.
@QJF3 Try below URL to get list of users. object_type can be changed to package or to get everything don't pass it. https://inventory.data.gov/api/action/member_list?id=va-gov&object_type=user
It works. Are you saying no user credentials, in the form of an authorization key are other key, are needed to read any content in inventory.data.gov?
In CKAN, for public organization “member_list” api method is public. http://docs.ckan.org/en/ckan-2.2/api.html#ckan.logic.action.get.member_list
However in inventory to get any specific package or user information, user will get redirected to login page. Other than member_list only data store related API's are public in inventory.
@ykhadilkar-rei How do I access private metadata in Inventory without being redirected to login page?
I suggesting using https://github.com/GSA/ckan-php-manager @alex-perfilov-reisys
@QJF3 with httpie, try this next time:
$ http -v GET "https://inventory.data.gov/api/3/action/package_show?id=XXX" Authorization:YYY Cookie:auth_tkt=foo
where:
XXX
= private package idYYY
= your CKAN API keySorry its been so long since I was able to reply. Thanks for the suggestion @alex-perfilov-reisys, it worked.
For Inventory, I can't seem to access any content from organization va-gov, so I don't know to find the package_show?id=XXX through the API.
@QJF3 did you try package_search?q=organization:va-gov
?
Thanks @alex-perfilov-reisys. I am not returning all VA records, but some, so I can work it out from here. I am closing this issue.
@QJF3 , there is a hard limit of 1000 rows, so you will never get more than that per request. But you can use pagination, defining start
and rows
params, check docs for more http://docs.ckan.org/en/latest/api/#ckan.logic.action.get.package_search
I am using httpie to test how to access inventory.data.gov. Any api methods with zero or more parameters generates a http error of 302 and redirects me to the inventory.data.gov/login. Not sure what I am doing wrong to use the APIs. My goals is to be able to update my organization's datasets in batch instead of through a manual process. Here's the log:
PS C:\Users\Dev> http -v GET https://inventory.data.gov/api/3/member_list id=userID Authorization:xxxxx-xx-xxx GET /api/3/member_list HTTP/1.1 Accept: application/json Accept-Encoding: gzip, deflate Authorization: xxxxx-xx-xxx Connection: keep-alive Content-Length: 21 Content-Type: application/json Host: inventory.data.gov User-Agent: HTTPie/0.9.2
{ "id": "userID" }
HTTP/1.1 302 Found Connection: Keep-Alive Content-Encoding: gzip Content-Length: 194 Content-Type: text/html; charset=iso-8859-1 Date: Mon, 05 Oct 2015 01:11:15 GMT Keep-Alive: timeout=15, max=100 Location: https://inventory.data.gov/user/login Server: Apache Vary: Accept-Encoding X-Frame-Options: SAMEORIGIN
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
Found
The document has moved here.
PS C:\Users\Dev>