is it possible to get metadata of an OData service in JSON format?
When I try to use format=json
, it doesn't work. Here is what I tried:
http://odata.informea.org/services/odata.svc/$metadata/?format=json
Metadata may be retrieved in JSON format using our REST API, or in XML format as documented below. Most DOI-to-metadata queries are done via HTTPS using synchronous HTTPS queries, but may also be submitted as asynchronous batch queries.
The OData $metadata file is a CSDL file that is made available to clients to help them discover the structure and organization of the entities, navigations, and the service operations that are available to manage resources beyond the usual create, retrieve, update, or delete operations.
The OData spec also has a query parameter, $format, that accepts json as one of its values. Although using this format parameter to request JSON is part of the OData specification, not every data service knows how to process the parameter. In fact, when you create a . NET WCF Data Service, it returns ATOM by default.
The $metadata
document is in the CSDL format, which currently only has an XML representation. (As a side note, if you do want to request the json format for a different kind of OData payload, make sure the format
query token has a $
in front of it: $format=json
.)
So, no it is not possible. You can, however, get the service document in JSON, which is a subset of the $metadata document:
http://odata.informea.org/services/odata.svc?$format=json
This won't have type information, but it will list the available entry points of the service (i.e., the entity sets).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With