以JSON格式获取OData $ metadata [英] Get OData $metadata in JSON format
问题描述
能否以JSON格式获取OData服务的元数据?
is it possible to get metadata of an OData service in JSON format?
当我尝试使用format=json
时,它不起作用.这是我尝试过的:
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
文档为CSDL格式,当前仅具有XML表示形式. (作为一个补充说明,如果您确实想为另一种OData有效负载请求json格式,请确保format
查询令牌的前面带有$
:$format=json
.)
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
.)
因此,不可能.但是,您可以使用JSON获取服务文档,该文档是$ metadata文档的子集:
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).
这篇关于以JSON格式获取OData $ metadata的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!