我正在使用来自https://github.com/mulesoft/apikit-odata-example的 odata 示例。
当我包含 inlinecount 过滤器(请参阅下面的请求)时,计数不会随结果一起返回。如何将计数添加到响应中?
请求:http://localhost:8081/api/odata.svc/customers ?$format=json&$inlinecount=allpages
回复:
{
"d": {
"results": [
{
"__metadata": {
"uri": "http://localhost:8081/api/odata.svc/customers('')",
"type": "odata2.namespace.customers"
},
"CompanyName": "Alfreds Futterkiste",
"ContactName": "Maria Anders",
"ContactTitle": "Sales Representative",
"CustomerID": ""
},
{
"__metadata": {
"uri": "http://localhost:8081/api/odata.svc/customers('ALFKI')",
"type": "odata2.namespace.customers"
},
"CompanyName": "Alfreds Futterkiste",
"ContactName": "Maria Anders",
"ContactTitle": "Sales Representative",
"CustomerID": "ALFKI"
},
{
"__metadata": {
"uri": "http://localhost:8081/api/odata.svc/customers('ANATR')",
"type": "odata2.namespace.customers"
},
"CompanyName": "Ana Trujillo Emparedados y helados",
"ContactName": "Ana Trujillo",
"ContactTitle": "Owner",
"CustomerID": "ANATR"
},
{
"__metadata": {
"uri": "http://localhost:8081/api/odata.svc/customers('ANTON')",
"type": "odata2.namespace.customers"
},
"CompanyName": "Antonio Moreno Taquera",
"ContactName": "Antonio Moreno",
"ContactTitle": "Owner",
"CustomerID": "ANTON"
},
{
"__metadata": {
"uri": "http://localhost:8081/api/odata.svc/customers('AROUT')",
"type": "odata2.namespace.customers"
},
"CompanyName": "Around the Horn",
"ContactName": "Thomas Hardy",
"ContactTitle": "Sales Representative",
"CustomerID": "AROUT"
},
{
"__metadata": {
"uri": "http://localhost:8081/api/odata.svc/customers('BERGS')",
"type": "odata2.namespace.customers"
},
"CompanyName": "Berglunds snabbkp",
"ContactName": "Christina Berglund",
"ContactTitle": "Order Administrator",
"CustomerID": "BERGS"
},
{
"__metadata": {
"uri": "http://localhost:8081/api/odata.svc/customers('BLAUS')",
"type": "odata2.namespace.customers"
},
"CompanyName": "Blauer See Delikatessen",
"ContactName": "Hanna Moos",
"ContactTitle": "Sales Representative",
"CustomerID": "BLAUS"
},
{
"__metadata": {
"uri": "http://localhost:8081/api/odata.svc/customers('BLONP')",
"type": "odata2.namespace.customers"
},
"CompanyName": "Blondesddsl pre et fils",
"ContactName": "Frdrique Citeaux",
"ContactTitle": "Marketing Manager",
"CustomerID": "BLONP"
},
{
"__metadata": {
"uri": "http://localhost:8081/api/odata.svc/customers('BOLID')",
"type": "odata2.namespace.customers"
},
"CompanyName": "Blido Comidas preparadas",
"ContactName": "Martn Sommer",
"ContactTitle": "Owner",
"CustomerID": "BOLID"
},
{
"__metadata": {
"uri": "http://localhost:8081/api/odata.svc/customers('BONAP')",
"type": "odata2.namespace.customers"
},
"CompanyName": "Bon app'",
"ContactName": "Laurence Lebihan",
"ContactTitle": "Owner",
"CustomerID": "BONAP"
},
{
"__metadata": {
"uri": "http://localhost:8081/api/odata.svc/customers('BOTTM')",
"type": "odata2.namespace.customers"
},
"CompanyName": "Bottom-Dollar Markets",
"ContactName": "Elizabeth Lincoln",
"ContactTitle": "Accounting Manager",
"CustomerID": "BOTTM"
},
{
"__metadata": {
"uri": "http://localhost:8081/api/odata.svc/customers('BSBEV')",
"type": "odata2.namespace.customers"
},
"CompanyName": "B's Beverages",
"ContactName": "Victoria Ashworth",
"ContactTitle": "Sales Representative",
"CustomerID": "BSBEV"
},
{
"__metadata": {
"uri": "http://localhost:8081/api/odata.svc/customers('CACTU')",
"type": "odata2.namespace.customers"
},
"CompanyName": "Cactus Comidas para llevar",
"ContactName": "Patricio Simpson",
"ContactTitle": "Sales Agent",
"CustomerID": "CACTU"
},
{
"__metadata": {
"uri": "http://localhost:8081/api/odata.svc/customers('CENTC')",
"type": "odata2.namespace.customers"
},
"CompanyName": "Centro comercial Moctezuma",
"ContactName": "Francisco Chang",
"ContactTitle": "Marketing Manager",
"CustomerID": "CENTC"
},
{
"__metadata": {
"uri": "http://localhost:8081/api/odata.svc/customers('CHOPS')",
"type": "odata2.namespace.customers"
},
"CompanyName": "Chop-suey Chinese",
"ContactName": "Yang Wang",
"ContactTitle": "Owner",
"CustomerID": "CHOPS"
},
{
"__metadata": {
"uri": "http://localhost:8081/api/odata.svc/customers('COMMI')",
"type": "odata2.namespace.customers"
},
"CompanyName": "Comrcio Mineiro",
"ContactName": "Pedro Afonso",
"ContactTitle": "Sales Associate",
"CustomerID": "COMMI"
},
{
"__metadata": {
"uri": "http://localhost:8081/api/odata.svc/customers('CONSH')",
"type": "odata2.namespace.customers"
},
"CompanyName": "Consolidated Holdings",
"ContactName": "Elizabeth Brown",
"ContactTitle": "Sales Representative",
"CustomerID": "CONSH"
},
{
"__metadata": {
"uri": "http://localhost:8081/api/odata.svc/customers('DRACD')",
"type": "odata2.namespace.customers"
},
"CompanyName": "Drachenblut Delikatessen",
"ContactName": "Sven Ottlieb",
"ContactTitle": "Order Administrator",
"CustomerID": "DRACD"
},
{
"__metadata": {
"uri": "http://localhost:8081/api/odata.svc/customers('DUMON')",
"type": "odata2.namespace.customers"
},
"CompanyName": "Du monde entier",
"ContactName": "Janine Labrune",
"ContactTitle": "Owner",
"CustomerID": "DUMON"
},
{
"__metadata": {
"uri": "http://localhost:8081/api/odata.svc/customers('EASTC')",
"type": "odata2.namespace.customers"
},
"CompanyName": "Eastern Connection",
"ContactName": "Ann Devon",
"ContactTitle": "Sales Agent",
"CustomerID": "EASTC"
},
{
"__metadata": {
"uri": "http://localhost:8081/api/odata.svc/customers('ERNSH')",
"type": "odata2.namespace.customers"
},
"CompanyName": "Ernst Handel",
"ContactName": "Roland Mendel",
"ContactTitle": "Sales Manager",
"CustomerID": "ERNSH"
},
{
"__metadata": {
"uri": "http://localhost:8081/api/odata.svc/customers('FAMIA')",
"type": "odata2.namespace.customers"
},
"CompanyName": "Familia Arquibaldo",
"ContactName": "Aria Cruz",
"ContactTitle": "Marketing Assistant",
"CustomerID": "FAMIA"
},
{
"__metadata": {
"uri": "http://localhost:8081/api/odata.svc/customers('FANT')",
"type": "odata2.namespace.customers"
},
"CompanyName": "Fantasma",
"ContactName": "Casper",
"ContactTitle": "Evasor Profesional",
"CustomerID": "FANT"
},
{
"__metadata": {
"uri": "http://localhost:8081/api/odata.svc/customers('FISSA')",
"type": "odata2.namespace.customers"
},
"CompanyName": "FISSA Fabrica Inter. Salchichas S.A.",
"ContactName": "Diego Roel",
"ContactTitle": "Accounting Manager",
"CustomerID": "FISSA"
},
{
"__metadata": {
"uri": "http://localhost:8081/api/odata.svc/customers('FOLIG')",
"type": "odata2.namespace.customers"
},
"CompanyName": "Folies gourmandes",
"ContactName": "Martine Ranc",
"ContactTitle": "Assistant Sales Agent",
"CustomerID": "FOLIG"
},
{
"__metadata": {
"uri": "http://localhost:8081/api/odata.svc/customers('FOLKO')",
"type": "odata2.namespace.customers"
},
"CompanyName": "Folk och f HB",
"ContactName": "Maria Larsson",
"ContactTitle": "Owner",
"CustomerID": "FOLKO"
},
{
"__metadata": {
"uri": "http://localhost:8081/api/odata.svc/customers('FRANK')",
"type": "odata2.namespace.customers"
},
"CompanyName": "Frankenversand",
"ContactName": "Peter Franken",
"ContactTitle": "Marketing Manager",
"CustomerID": "FRANK"
},
{
"__metadata": {
"uri": "http://localhost:8081/api/odata.svc/customers('FRANR')",
"type": "odata2.namespace.customers"
},
"CompanyName": "France restauration",
"ContactName": "Carine Schmitt",
"ContactTitle": "Marketing Manager",
"CustomerID": "FRANR"
},
{
"__metadata": {
"uri": "http://localhost:8081/api/odata.svc/customers('FRANS')",
"type": "odata2.namespace.customers"
},
"CompanyName": "Franchi S.p.A.",
"ContactName": "Paolo Accorti",
"ContactTitle": "Sales Representative",
"CustomerID": "FRANS"
},
{
"__metadata": {
"uri": "http://localhost:8081/api/odata.svc/customers('FURIB')",
"type": "odata2.namespace.customers"
},
"CompanyName": "Furia Bacalhau e Frutos do Mar",
"ContactName": "Lino Rodriguez",
"ContactTitle": "Sales Manager",
"CustomerID": "FURIB"
},
{
"__metadata": {
"uri": "http://localhost:8081/api/odata.svc/customers('GALED')",
"type": "odata2.namespace.customers"
},
"CompanyName": "Galera del gastrnomo",
"ContactName": "Eduardo Saavedra",
"ContactTitle": "Marketing Manager",
"CustomerID": "GALED"
},
{
"__metadata": {
"uri": "http://localhost:8081/api/odata.svc/customers('GODOS')",
"type": "odata2.namespace.customers"
},
"CompanyName": "Godos Cocina Tpica",
"ContactName": "Jos Pedro Freyre",
"ContactTitle": "Sales Manager",
"CustomerID": "GODOS"
},
{
"__metadata": {
"uri": "http://localhost:8081/api/odata.svc/customers('GOURL')",
"type": "odata2.namespace.customers"
},
"CompanyName": "Gourmet Lanchonetes",
"ContactName": "Andr Fonseca",
"ContactTitle": "Sales Associate",
"CustomerID": "GOURL"
},
{
"__metadata": {
"uri": "http://localhost:8081/api/odata.svc/customers('GREAL')",
"type": "odata2.namespace.customers"
},
"CompanyName": "Great Lakes Food Market",
"ContactName": "Howard Snyder",
"ContactTitle": "Marketing Manager",
"CustomerID": "GREAL"
},
{
"__metadata": {
"uri": "http://localhost:8081/api/odata.svc/customers('GROSR')",
"type": "odata2.namespace.customers"
},
"CompanyName": "GROSELLA-Restaurante",
"ContactName": "Manuel Pereira",
"ContactTitle": "Owner",
"CustomerID": "GROSR"
},
{
"__metadata": {
"uri": "http://localhost:8081/api/odata.svc/customers('HANAR')",
"type": "odata2.namespace.customers"
},
"CompanyName": "Hanari Carnes",
"ContactName": "Mario Pontes",
"ContactTitle": "Accounting Manager",
"CustomerID": "HANAR"
},
{
"__metadata": {
"uri": "http://localhost:8081/api/odata.svc/customers('HILAA')",
"type": "odata2.namespace.customers"
},
"CompanyName": "HILARION-Abastos",
"ContactName": "Carlos Hernndez",
"ContactTitle": "Sales Representative",
"CustomerID": "HILAA"
},
{
"__metadata": {
"uri": "http://localhost:8081/api/odata.svc/customers('HUNGC')",
"type": "odata2.namespace.customers"
},
"CompanyName": "Hungry Coyote Import Store",
"ContactName": "Yoshi Latimer",
"ContactTitle": "Sales Representative",
"CustomerID": "HUNGC"
},
{
"__metadata": {
"uri": "http://localhost:8081/api/odata.svc/customers('HUNGO')",
"type": "odata2.namespace.customers"
},
"CompanyName": "Hungry Owl All-Night Grocers",
"ContactName": "Patricia McKenna",
"ContactTitle": "Sales Associate",
"CustomerID": "HUNGO"
},
{
"__metadata": {
"uri": "http://localhost:8081/api/odata.svc/customers('ISLAT')",
"type": "odata2.namespace.customers"
},
"CompanyName": "Island Trading",
"ContactName": "Helen Bennett",
"ContactTitle": "Marketing Manager",
"CustomerID": "ISLAT"
},
{
"__metadata": {
"uri": "http://localhost:8081/api/odata.svc/customers('KOENE')",
"type": "odata2.namespace.customers"
},
"CompanyName": "Kniglich Essen",
"ContactName": "Philip Cramer",
"ContactTitle": "Sales Associate",
"CustomerID": "KOENE"
},
{
"__metadata": {
"uri": "http://localhost:8081/api/odata.svc/customers('LACOR')",
"type": "odata2.namespace.customers"
},
"CompanyName": "La corne d'abondance",
"ContactName": "Daniel Tonini",
"ContactTitle": "Sales Representative",
"CustomerID": "LACOR"
},
{
"__metadata": {
"uri": "http://localhost:8081/api/odata.svc/customers('LAMAI')",
"type": "odata2.namespace.customers"
},
"CompanyName": "La maison d'Asie",
"ContactName": "Annette Roulet",
"ContactTitle": "Sales Manager",
"CustomerID": "LAMAI"
},
{
"__metadata": {
"uri": "http://localhost:8081/api/odata.svc/customers('LAUGB')",
"type": "odata2.namespace.customers"
},
"CompanyName": "Laughing Bacchus Wine Cellars",
"ContactName": "Yoshi Tannamuri",
"ContactTitle": "Marketing Assistant",
"CustomerID": "LAUGB"
},
{
"__metadata": {
"uri": "http://localhost:8081/api/odata.svc/customers('LAZYK')",
"type": "odata2.namespace.customers"
},
"CompanyName": "Lazy K Kountry Store",
"ContactName": "John Steel",
"ContactTitle": "Marketing Manager",
"CustomerID": "LAZYK"
},
{
"__metadata": {
"uri": "http://localhost:8081/api/odata.svc/customers('LEHMS')",
"type": "odata2.namespace.customers"
},
"CompanyName": "Lehmanns Marktstand",
"ContactName": "Renate Messner",
"ContactTitle": "Sales Representative",
"CustomerID": "LEHMS"
},
{
"__metadata": {
"uri": "http://localhost:8081/api/odata.svc/customers('LETSS')",
"type": "odata2.namespace.customers"
},
"CompanyName": "Let's Stop N Shop",
"ContactName": "Jaime Yorres",
"ContactTitle": "Owner",
"CustomerID": "LETSS"
},
{
"__metadata": {
"uri": "http://localhost:8081/api/odata.svc/customers('LILAS')",
"type": "odata2.namespace.customers"
},
"CompanyName": "LILA-Supermercado",
"ContactName": "Carlos Gonzlez",
"ContactTitle": "Accounting Manager",
"CustomerID": "LILAS"
},
{
"__metadata": {
"uri": "http://localhost:8081/api/odata.svc/customers('LINOD')",
"type": "odata2.namespace.customers"
},
"CompanyName": "LINO-Delicateses",
"ContactName": "Felipe Izquierdo",
"ContactTitle": "Owner",
"CustomerID": "LINOD"
},
{
"__metadata": {
"uri": "http://localhost:8081/api/odata.svc/customers('LONEP')",
"type": "odata2.namespace.customers"
},
"CompanyName": "Lonesome Pine Restaurant",
"ContactName": "Fran Wilson",
"ContactTitle": "Sales Manager",
"CustomerID": "LONEP"
},
{
"__metadata": {
"uri": "http://localhost:8081/api/odata.svc/customers('MAGAA')",
"type": "odata2.namespace.customers"
},
"CompanyName": "Magazzini Alimentari Riuniti",
"ContactName": "Giovanni Rovelli",
"ContactTitle": "Marketing Manager",
"CustomerID": "MAGAA"
},
{
"__metadata": {
"uri": "http://localhost:8081/api/odata.svc/customers('MAISD')",
"type": "odata2.namespace.customers"
},
"CompanyName": "Maison Dewey",
"ContactName": "Catherine Dewey",
"ContactTitle": "Sales Agent",
"CustomerID": "MAISD"
},
{
"__metadata": {
"uri": "http://localhost:8081/api/odata.svc/customers('MEREP')",
"type": "odata2.namespace.customers"
},
"CompanyName": "Mre Paillarde",
"ContactName": "Jean Fresnire",
"ContactTitle": "Marketing Assistant",
"CustomerID": "MEREP"
},
{
"__metadata": {
"uri": "http://localhost:8081/api/odata.svc/customers('MORGK')",
"type": "odata2.namespace.customers"
},
"CompanyName": "Morgenstern Gesundkost",
"ContactName": "Alexander Feuer",
"ContactTitle": "Marketing Assistant",
"CustomerID": "MORGK"
},
{
"__metadata": {
"uri": "http://localhost:8081/api/odata.svc/customers('NORTS')",
"type": "odata2.namespace.customers"
},
"CompanyName": "North/South",
"ContactName": "Simon Crowther",
"ContactTitle": "Sales Associate",
"CustomerID": "NORTS"
}
...
]
}
}