Closed MikePulsiferDOL closed 9 years ago
This is actually the correct behavior.
When linking to an API, you're actually just linking to the documentation for the API as explained in the API guidance
If your API is able to output the entire dataset in a particular format with one URL then you can treat each format it outputs just like a separate downloadURL rather than an API
There's more background in the comment on the other issue including options to provide more detailed metadata for your APIs: https://github.com/GSA/project-open-data-dashboard/issues/91#issuecomment-89004943
We do not set the format returned in the URL, but rather in the accept header. If we use CKAN as it currently works, we'd be telling the world our APIs are XML-only, which isn't true.
Edit: I believe you are confusing the URL field in CKAN with the Data Dictionary field.
The nuances of API parameters are beyond the scope of DCAT and the Project Open Data schema which is why we added the describedBy
field (aka Data Dictionary) so that you can provide Machine Readable API Documentation such as Swagger, RAML, API Blueprint, HAL, Hydra to define those. It seems like you're attempting to use an API to specify a downloadURL
but if you're not able to provide a downloadURL for the full dataset or for the format you've specified with mediaType
then you'll need to simply provide it as an API (an accessURL
with a format
of "API" and no mediaType
specified) and then rely on the Machine Readable API Documentation option explained in the API guidance
I'm not trying to do ANYTHING to describedBy. I'm trying to change the accessURL, but CKAN is forcing a mime type into format that I can't delete.
The current Project Open Data schema and inventory.data.gov do not provide a way to specify the mime type (aka mediaType
) for APIs or any accessURL
- only for a downloadURL
. If you want to specify different mime types supported by an API, you'd need to use the describedBy
field with a corresponding URL to machine readable API docs. Anything that is specified as an API in inventory.data.gov generates a JSON metadata record that doesn't specify the mediaType at all. This is correct.
It looks like what is causing confusion is that when you select "Link to an API" on inventory.data.gov it still shows the option to specify a media type and will even run tests to check the media type of the URL. These should be hidden and disabled when "Link to an API" is selected since the media type is totally ignored and left out when the JSON is generated for any resource that has "Link to an API" selected.
I'll rename this issue and reopen it so that we address this.
The above change is in inventory production
I'm trying to edit a dataset resource for https://inventory.data.gov/dataset/2010-workforce-investment-act-wages by adding a sample key and setting the resource type to "link to an API." Our API offers both JSON and XML (v1 is XML by default, v2 (June) will be JSON by default). CKAN is now not letting me set the media type to API as we were instructed to do in the past. If I let CKAN determine, based on its mime-type check that is an XML resource, then we'll have a lie on our hands.