GSA / enterprise-data-inventory

The Enterprise Data Inventory is a CKAN based data management system for private and public data management
7 stars 5 forks source link

'The \'accessURL\' field has an invalid URL: #167

Closed MikePulsiferDOL closed 9 years ago

MikePulsiferDOL commented 9 years ago

('Invalid Required Field Value', [u'The \'accessURL\' field has an invalid URL: "http://api.dol.gov/V1/ApiMetrics/PerKey/NumberOfRequestsPerMonthByKeys?KEY=352e8ef9-7b38-4428-875b-eefd39df6289&$filter=TOKEN eq guid\'352e8ef9-7b38-4428-875b-eefd39df6289\'". (1 locations)'])

The URL is valid (try it in Chrome). Because of the way this dataset is set up on the back end, you need everything after the key. This is because it provides user metrics for a particular API key. Without a key/token, there's nothing to provide so it errors out.

Thus, I either get this error from CKAN or there will be broken links in the data.json.

vasili4 commented 9 years ago

Chrome is fixing bad urls automatically. CKAN doesn't.

Just urlencode() your urls and they will become valid.

%20 instead space " " %27 instead single quote '

http://api.dol.gov/V1/ApiMetrics/PerKey/NumberOfRequestsPerMonthByKeys?KEY=352e8ef9-7b38-4428-875b-eefd39df6289&$filter=TOKEN%20eq%20guid%27352e8ef9-7b38-4428-875b-eefd39df6289%27

Chrome makes same, before making the request

MikePulsiferDOL commented 9 years ago

Thanks. That worked.