OData
Read and write OData v2 and v4 services such as SAP Gateway, Dynamics 365, Dataverse and Business Central: metadata, JSON filters, paging, CRUD by key, functions and $batch. Typical uses: read SAP or Dynamics data into a report, push orders or customers into an ERP.
odata pingodata collectionsodata metadataodata metadataodata findodata findodata getodata getodata countodata countodata countodata insertodata insertodata updateodata updateodata deleteodata deleteodata callodata callodata callodata batchodata batchodata requestodata request

odata ping <config>


Description

    Test the service and the credentials with the service document: {ok, version, entity_sets} (the number of entity sets)

Parameters

    config:   The OData service as JSON: url (the service root, like https://host/sap/opu/odata/sap/API_BUSINESS_PARTNER, https://org.crm.dynamics.com/api/data/v9.2 or https://api.businesscentral.dynamics.com/v2.0///api/v2.0), version (auto: read from the service document; 2 or 4), the authentication: username and password (basic), token (bearer), or token_url, client_id, client_secret, scope, resource (OAuth2 client credentials, cached until its expiry), sap_client (3 digits, the sap-client parameter of every request), query (parameters added to every request, like {"sap-language": "EN"}), headers and secret_headers (extra headers, the second one reads the values from secrets), csrf (auto: the X-CSRF-Token is fetched when a write is refused with X-CSRF-Token: Required; true: fetched before the first write; false: never), allow_plain (false: credentials over http are refused unless the host is local), ca_file (a PEM file of a private CA), timeout_ms (30000), max_bytes (64 MB, the largest answer) - String - required
admin
odata ping "{\"url\": \"https://services.odata.org/V4/(S(mentdbv4examples))/TripPinServiceRW\"}"
mentdb
{"ok": true, "version": "4.0", "entity_sets": 4}
OData v2 (fixed result: real OData v2 reference service, services.odata.org)
admin
odata ping "{\"url\": \"https://services.odata.org/V2/(S(mentdbv2examples))/OData/OData.svc\"}"
mentdb
{"ok": true, "version": "1.0", "entity_sets": 3}

odata collections <config>


Description

    The names of the entity sets of the service document

Parameters

    config:   The OData service as JSON: url (the service root, like https://host/sap/opu/odata/sap/API_BUSINESS_PARTNER, https://org.crm.dynamics.com/api/data/v9.2 or https://api.businesscentral.dynamics.com/v2.0///api/v2.0), version (auto: read from the service document; 2 or 4), the authentication: username and password (basic), token (bearer), or token_url, client_id, client_secret, scope, resource (OAuth2 client credentials, cached until its expiry), sap_client (3 digits, the sap-client parameter of every request), query (parameters added to every request, like {"sap-language": "EN"}), headers and secret_headers (extra headers, the second one reads the values from secrets), csrf (auto: the X-CSRF-Token is fetched when a write is refused with X-CSRF-Token: Required; true: fetched before the first write; false: never), allow_plain (false: credentials over http are refused unless the host is local), ca_file (a PEM file of a private CA), timeout_ms (30000), max_bytes (64 MB, the largest answer) - String - required
admin
odata collections "{\"url\": \"https://services.odata.org/V4/(S(mentdbv4examples))/TripPinServiceRW\"}"
mentdb
["Photos", "People", "Airlines", "Airports"]

odata metadata <config>


Description

    The $metadata (32 MB at most unless max_bytes is given) as rows, one per property and navigation property of each entity set: {entity_set, entity_type, name, kind (property or navigation), type, key, nullable, max_length, precision, scale, target_set}

Parameters

    config:   The OData service as JSON: url (the service root, like https://host/sap/opu/odata/sap/API_BUSINESS_PARTNER, https://org.crm.dynamics.com/api/data/v9.2 or https://api.businesscentral.dynamics.com/v2.0///api/v2.0), version (auto: read from the service document; 2 or 4), the authentication: username and password (basic), token (bearer), or token_url, client_id, client_secret, scope, resource (OAuth2 client credentials, cached until its expiry), sap_client (3 digits, the sap-client parameter of every request), query (parameters added to every request, like {"sap-language": "EN"}), headers and secret_headers (extra headers, the second one reads the values from secrets), csrf (auto: the X-CSRF-Token is fetched when a write is refused with X-CSRF-Token: Required; true: fetched before the first write; false: never), allow_plain (false: credentials over http are refused unless the host is local), ca_file (a PEM file of a private CA), timeout_ms (30000), max_bytes (64 MB, the largest answer) - String - required
admin
odata metadata "{\"url\": \"https://services.odata.org/V2/(S(mentdbv2examples))/OData/OData.svc\"}"
mentdb
[{"entity_set": "Products", "entity_type": "ODataDemo.Product", "name": "ID", "kind": "property", "type": "Edm.Int32", "key": true, "nullable": false, "max_length": null, "precision": null, "scale": null, "target_set": null}, {"entity_set": "Products", "entity_type": "ODataDemo.Product", "name": "Name", "kind": "property", "type": "Edm.String", "key": false, "nullable": true, "max_length": null, "precision": null, "scale": null, "target_set": null}, {"entity_set": "Products", "entity_type": "ODataDemo.Product", "name": "Description", "kind": "property", "type": "Edm.String", "key": false, "nullable": true, "max_length": null, "precision": null, "scale": null, "target_set": null}, {"entity_set": "Products", "entity_type": "ODataDemo.Product", "name": "ReleaseDate", "kind": "property", "type": "Edm.DateTime", "key": false, "nullable": false, "max_length": null, "precision": null, "scale": null, "target_set": null}, {"entity_set": "Products", "entity_type": "ODataDemo.Product", "name": "DiscontinuedDate", "kind": "property", "type": "Edm.DateTime", "key": false, "nullable": true, "max_length": null, "precision": null, "scale": null, "target_set": null}, {"entity_set": "Products", "entity_type": "ODataDemo.Product", "name": "Rating", "kind": "property", "type": "Edm.Int32", "key": false, "nullable": false, "max_length": null, "precision": null, "scale": null, "target_set": null}, {"entity_set": "Products", "entity_type": "ODataDemo.Product", "name": "Price", "kind": "property", "type": "Edm.Decimal", "key": false, "nullable": false, "max_length": null, "precision": null, "scale": null, "target_set": null}, {"entity_set": "Products", "entity_type": "ODataDemo.Product", "name": "Category", "kind": "navigation", "type": "ODataDemo.Category", "key": false, "nullable": null, "max_length": null, "precision": null, "scale": null, "target_set": "Categories"}, {"entity_set": "Products", "entity_type": "ODataDemo.Product", "name": "Supplier", "kind": "navigation", "type": "ODataDemo.Supplier", "key": false, "nullable": null, "max_length": null, "precision": null, "scale": null, "target_set": "Suppliers"}, {"entity_set": "Categories", "entity_type": "ODataDemo.Category", "name": "ID", "kind": "property", "type": "Edm.Int32", "key": true, "nullable": false, "max_length": null, "precision": null, "scale": null, "target_set": null}, {"entity_set": "Categories", "entity_type": "ODataDemo.Category", "name": "Name", "kind": "property", "type": "Edm.String", "key": false, "nullable": true, "max_length": null, "precision": null, "scale": null, "target_set": null}, {"entity_set": "Categories", "entity_type": "ODataDemo.Category", "name": "Products", "kind": "navigation", "type": "Collection(ODataDemo.Product)", "key": false, "nullable": null, "max_length": null, "precision": null, "scale": null, "target_set": "Products"}, {"entity_set": "Suppliers", "entity_type": "ODataDemo.Supplier", "name": "ID", "kind": "property", "type": "Edm.Int32", "key": true, "nullable": false, "max_length": null, "precision": null, "scale": null, "target_set": null}, {"entity_set": "Suppliers", "entity_type": "ODataDemo.Supplier", "name": "Name", "kind": "property", "type": "Edm.String", "key": false, "nullable": true, "max_length": null, "precision": null, "scale": null, "target_set": null}, {"entity_set": "Suppliers", "entity_type": "ODataDemo.Supplier", "name": "Address", "kind": "property", "type": "ODataDemo.Address", "key": false, "nullable": false, "max_length": null, "precision": null, "scale": null, "target_set": null}, {"entity_set": "Suppliers", "entity_type": "ODataDemo.Supplier", "name": "Concurrency", "kind": "property", "type": "Edm.Int32", "key": false, "nullable": false, "max_length": null, "precision": null, "scale": null, "target_set": null}, {"entity_set": "Suppliers", "entity_type": "ODataDemo.Supplier", "name": "Products", "kind": "navigation", "type": "Collection(ODataDemo.Product)", "key": false, "nullable": null, "max_length": null, "precision": null, "scale": null, "target_set": "Products"}]

odata metadata <config> <options_json>


Description

    The $metadata with options: level (properties, entity_sets: {name, kind (entity_set or singleton), entity_type, keys, properties, navigation}, functions: the function and action imports and the bound ones {name, kind, bound, binding_type, http_method, return_type, parameters}, summary: the counts), entity_set (only one entity set)

Parameters

    config:   The OData service as JSON: url (the service root, like https://host/sap/opu/odata/sap/API_BUSINESS_PARTNER, https://org.crm.dynamics.com/api/data/v9.2 or https://api.businesscentral.dynamics.com/v2.0///api/v2.0), version (auto: read from the service document; 2 or 4), the authentication: username and password (basic), token (bearer), or token_url, client_id, client_secret, scope, resource (OAuth2 client credentials, cached until its expiry), sap_client (3 digits, the sap-client parameter of every request), query (parameters added to every request, like {"sap-language": "EN"}), headers and secret_headers (extra headers, the second one reads the values from secrets), csrf (auto: the X-CSRF-Token is fetched when a write is refused with X-CSRF-Token: Required; true: fetched before the first write; false: never), allow_plain (false: credentials over http are refused unless the host is local), ca_file (a PEM file of a private CA), timeout_ms (30000), max_bytes (64 MB, the largest answer) - String - required
    options_json:   The options - String - required
admin
odata metadata "{\"url\": \"https://services.odata.org/V4/(S(mentdbv4examples))/TripPinServiceRW\"}" "{\"level\": \"entity_sets\"}"
mentdb
[{"name": "Photos", "kind": "entity_set", "entity_type": "Microsoft.OData.SampleService.Models.TripPin.Photo", "keys": ["Id"], "properties": 2, "navigation": []}, {"name": "People", "kind": "entity_set", "entity_type": "Microsoft.OData.SampleService.Models.TripPin.Person", "keys": ["UserName"], "properties": 7, "navigation": ["Friends", "Trips", "Photo"]}, {"name": "Airlines", "kind": "entity_set", "entity_type": "Microsoft.OData.SampleService.Models.TripPin.Airline", "keys": ["AirlineCode"], "properties": 2, "navigation": []}, {"name": "Airports", "kind": "entity_set", "entity_type": "Microsoft.OData.SampleService.Models.TripPin.Airport", "keys": ["IcaoCode"], "properties": 4, "navigation": []}, {"name": "Me", "kind": "singleton", "entity_type": "Microsoft.OData.SampleService.Models.TripPin.Person", "keys": ["UserName"], "properties": 7, "navigation": ["Friends", "Trips", "Photo"]}]
the functions and actions (fixed result: real OData v4 reference service TripPin, services.odata.org)
admin
odata metadata "{\"url\": \"https://services.odata.org/V4/(S(mentdbv4examples))/TripPinServiceRW\"}" "{\"level\": \"functions\"}"
mentdb
[{"name": "GetNearestAirport", "kind": "function", "bound": false, "binding_type": null, "http_method": "GET", "return_type": "Microsoft.OData.SampleService.Models.TripPin.Airport", "parameters": [{"name": "lat", "type": "Edm.Double"}, {"name": "lon", "type": "Edm.Double"}]}, {"name": "ResetDataSource", "kind": "action", "bound": false, "binding_type": null, "http_method": "POST", "return_type": null, "parameters": []}, {"name": "Microsoft.OData.SampleService.Models.TripPin.GetFavoriteAirline", "kind": "function", "bound": true, "binding_type": "Microsoft.OData.SampleService.Models.TripPin.Person", "http_method": "GET", "return_type": "Microsoft.OData.SampleService.Models.TripPin.Airline", "parameters": []}, {"name": "Microsoft.OData.SampleService.Models.TripPin.GetInvolvedPeople", "kind": "function", "bound": true, "binding_type": "Microsoft.OData.SampleService.Models.TripPin.Trip", "http_method": "GET", "return_type": "Collection(Microsoft.OData.SampleService.Models.TripPin.Person)", "parameters": []}, {"name": "Microsoft.OData.SampleService.Models.TripPin.GetFriendsTrips", "kind": "function", "bound": true, "binding_type": "Microsoft.OData.SampleService.Models.TripPin.Person", "http_method": "GET", "return_type": "Collection(Microsoft.OData.SampleService.Models.TripPin.Trip)", "parameters": [{"name": "userName", "type": "Edm.String"}]}, {"name": "Microsoft.OData.SampleService.Models.TripPin.ShareTrip", "kind": "action", "bound": true, "binding_type": "Microsoft.OData.SampleService.Models.TripPin.Person", "http_method": "POST", "return_type": null, "parameters": [{"name": "userName", "type": "Edm.String"}, {"name": "tripId", "type": "Edm.Int32"}]}]
one entity set with a composite key (fixed result: real OData v2 Northwind service, services.odata.org)
admin
odata metadata "{\"url\": \"https://services.odata.org/V2/Northwind/Northwind.svc\"}" "{\"entity_set\": \"Order_Details\"}"
mentdb
[{"entity_set": "Order_Details", "entity_type": "NorthwindModel.Order_Detail", "name": "OrderID", "kind": "property", "type": "Edm.Int32", "key": true, "nullable": false, "max_length": null, "precision": null, "scale": null, "target_set": null}, {"entity_set": "Order_Details", "entity_type": "NorthwindModel.Order_Detail", "name": "ProductID", "kind": "property", "type": "Edm.Int32", "key": true, "nullable": false, "max_length": null, "precision": null, "scale": null, "target_set": null}, {"entity_set": "Order_Details", "entity_type": "NorthwindModel.Order_Detail", "name": "UnitPrice", "kind": "property", "type": "Edm.Decimal", "key": false, "nullable": false, "max_length": null, "precision": 19, "scale": 4, "target_set": null}, {"entity_set": "Order_Details", "entity_type": "NorthwindModel.Order_Detail", "name": "Quantity", "kind": "property", "type": "Edm.Int16", "key": false, "nullable": false, "max_length": null, "precision": null, "scale": null, "target_set": null}, {"entity_set": "Order_Details", "entity_type": "NorthwindModel.Order_Detail", "name": "Discount", "kind": "property", "type": "Edm.Single", "key": false, "nullable": false, "max_length": null, "precision": null, "scale": null, "target_set": null}, {"entity_set": "Order_Details", "entity_type": "NorthwindModel.Order_Detail", "name": "Order", "kind": "navigation", "type": "NorthwindModel.Order", "key": false, "nullable": null, "max_length": null, "precision": null, "scale": null, "target_set": "Orders"}, {"entity_set": "Order_Details", "entity_type": "NorthwindModel.Order_Detail", "name": "Product", "kind": "navigation", "type": "NorthwindModel.Product", "key": false, "nullable": null, "max_length": null, "precision": null, "scale": null, "target_set": "Products"}]
the counts (fixed result: real OData v2 reference service, services.odata.org)
admin
odata metadata "{\"url\": \"https://services.odata.org/V2/(S(mentdbv2examples))/OData/OData.svc\"}" "{\"level\": \"summary\"}"
mentdb
{"version": "2.0", "entity_sets": 3, "entity_types": 3, "complex_types": 1, "functions": 1}

odata find <config> <entity_set> <filter_json>


Description

    The entities of a filter, as rows (every page is read: 10000 rows at most by default)

Parameters

    config:   The OData service as JSON: url (the service root, like https://host/sap/opu/odata/sap/API_BUSINESS_PARTNER, https://org.crm.dynamics.com/api/data/v9.2 or https://api.businesscentral.dynamics.com/v2.0///api/v2.0), version (auto: read from the service document; 2 or 4), the authentication: username and password (basic), token (bearer), or token_url, client_id, client_secret, scope, resource (OAuth2 client credentials, cached until its expiry), sap_client (3 digits, the sap-client parameter of every request), query (parameters added to every request, like {"sap-language": "EN"}), headers and secret_headers (extra headers, the second one reads the values from secrets), csrf (auto: the X-CSRF-Token is fetched when a write is refused with X-CSRF-Token: Required; true: fetched before the first write; false: never), allow_plain (false: credentials over http are refused unless the host is local), ca_file (a PEM file of a private CA), timeout_ms (30000), max_bytes (64 MB, the largest answer) - String - required
    entity_set:   The entity set (People), or a navigation path (People('russellwhyte')/Trips); inside a key, a / is written %2F (a valid %XX is kept as it is) and spaces are allowed - String - required
    filter_json:   The filter as a JSON object, written as $filter: {"City": "Paris"} (eq), {"Age": {"$gte": 18}} with $eq $ne $gt $gte $lt $lte $in $nin $contains $icontains $startswith $endswith $exists, $and / $or (arrays of filters), $not; a path with / or . for a complex property (Address/City); {} for every entity. Texts are quoted (O''Neil), numbers and booleans written as such (a large double stays in exponent form; an Edm.Decimal has 100 digits at most; invalid dates like 2024-02-30 are refused); other types (Guid, DateTime, Decimal, Int64 of v2, enumerations of v4) need the option types or use_metadata - String - required
admin
odata find "{\"url\": \"https://services.odata.org/V4/(S(mentdbv4examples))/TripPinServiceRW\"}" "People" "{\"FirstName\": \"Scott\"}"
mentdb
[{"UserName": "scottketchum", "FirstName": "Scott", "LastName": "Ketchum", "Emails": ["Scott@example.com"], "AddressInfo": [{"Address": "2817 Milton Dr.", "City": {"CountryRegion": "United States", "Name": "Albuquerque", "Region": "NM"}}], "Gender": "Male", "Concurrency": 639305294428840596}]
a comparison (v2: Price is an Edm.Decimal sent as text) (fixed result: real OData v2 reference service, services.odata.org)
admin
odata find "{\"url\": \"https://services.odata.org/V2/(S(mentdbv2examples))/OData/OData.svc\"}" "Products" "{\"Rating\": {\"$gte\": 4}}"
mentdb
[{"ID": 0, "Name": "Bread", "Description": "Whole grain bread", "ReleaseDate": "1992-01-01T00:00:00Z", "DiscontinuedDate": null, "Rating": 4, "Price": "2.5"}]

odata find <config> <entity_set> <filter_json> <options_json>


Description

    Find with options: select, expand, orderby (texts or arrays), top, skip, search ($search of v4), raw_filter (a native $filter, added with and), params (custom query options, like {"search": "x"} for SAP; the system options set by the function, $filter, $select, $top..., are refused there), max_rows (10000, 1000000 at most), max_pages (1000), keep_annotations, types (the Edm type of a property: {"ID": "Edm.Guid", "Born": "Edm.DateTime"}), use_metadata (true: the types and keys read from $metadata, cached 10 minutes)

Parameters

    config:   The OData service as JSON: url (the service root, like https://host/sap/opu/odata/sap/API_BUSINESS_PARTNER, https://org.crm.dynamics.com/api/data/v9.2 or https://api.businesscentral.dynamics.com/v2.0///api/v2.0), version (auto: read from the service document; 2 or 4), the authentication: username and password (basic), token (bearer), or token_url, client_id, client_secret, scope, resource (OAuth2 client credentials, cached until its expiry), sap_client (3 digits, the sap-client parameter of every request), query (parameters added to every request, like {"sap-language": "EN"}), headers and secret_headers (extra headers, the second one reads the values from secrets), csrf (auto: the X-CSRF-Token is fetched when a write is refused with X-CSRF-Token: Required; true: fetched before the first write; false: never), allow_plain (false: credentials over http are refused unless the host is local), ca_file (a PEM file of a private CA), timeout_ms (30000), max_bytes (64 MB, the largest answer) - String - required
    entity_set:   The entity set (People), or a navigation path (People('russellwhyte')/Trips); inside a key, a / is written %2F (a valid %XX is kept as it is) and spaces are allowed - String - required
    filter_json:   The filter as a JSON object, written as $filter: {"City": "Paris"} (eq), {"Age": {"$gte": 18}} with $eq $ne $gt $gte $lt $lte $in $nin $contains $icontains $startswith $endswith $exists, $and / $or (arrays of filters), $not; a path with / or . for a complex property (Address/City); {} for every entity. Texts are quoted (O''Neil), numbers and booleans written as such (a large double stays in exponent form; an Edm.Decimal has 100 digits at most; invalid dates like 2024-02-30 are refused); other types (Guid, DateTime, Decimal, Int64 of v2, enumerations of v4) need the option types or use_metadata - String - required
    options_json:   The options - String - required
admin
odata find "{\"url\": \"https://services.odata.org/V4/(S(mentdbv4examples))/TripPinServiceRW\"}" "People" "{\"LastName\": {\"$startswith\": \"K\"}}" "{\"select\": [\"UserName\", \"LastName\"], \"orderby\": \"UserName desc\"}"
mentdb
[{"UserName": "scottketchum", "LastName": "Ketchum"}, {"UserName": "kristakemp", "LastName": "Kemp"}]
three pages followed (the server sends 8 people per page) (fixed result: real OData v4 reference service TripPin, services.odata.org)
admin
odata find "{\"url\": \"https://services.odata.org/V4/(S(mentdbv4examples))/TripPinServiceRW\"}" "People" "{}" "{\"select\": \"UserName\"}"
mentdb
[{"UserName": "russellwhyte"}, {"UserName": "scottketchum"}, {"UserName": "ronaldmundy"}, {"UserName": "javieralfred"}, {"UserName": "willieashmore"}, {"UserName": "vincentcalabrese"}, {"UserName": "clydeguess"}, {"UserName": "keithpinckney"}, {"UserName": "marshallgaray"}, {"UserName": "ryantheriault"}, {"UserName": "elainestewart"}, {"UserName": "salliesampson"}, {"UserName": "jonirosales"}, {"UserName": "georginabarlow"}, {"UserName": "angelhuffman"}, {"UserName": "laurelosborn"}, {"UserName": "sandyosborn"}, {"UserName": "ursulabright"}, {"UserName": "genevievereeves"}, {"UserName": "kristakemp"}]
an enumeration of v4 (fixed result: real OData v4 reference service TripPin, services.odata.org)
admin
odata find "{\"url\": \"https://services.odata.org/V4/(S(mentdbv4examples))/TripPinServiceRW\"}" "People" "{\"Gender\": \"Female\", \"LastName\": {\"$in\": [\"Osborn\", \"Bright\"]}}" "{\"select\": [\"UserName\", \"Gender\"], \"types\": {\"Gender\": \"Microsoft.OData.SampleService.Models.TripPin.PersonGender\"}}"
mentdb
[{"UserName": "laurelosborn", "Gender": "Female"}, {"UserName": "sandyosborn", "Gender": "Female"}, {"UserName": "ursulabright", "Gender": "Female"}]
a navigation path (fixed result: real OData v4 reference service TripPin, services.odata.org)
admin
odata find "{\"url\": \"https://services.odata.org/V4/(S(mentdbv4examples))/TripPinServiceRW\"}" "People('russellwhyte')/Trips" "{}" "{\"select\": [\"TripId\", \"Name\", \"StartsAt\"]}"
mentdb
[{"TripId": 0, "Name": "Trip in US", "StartsAt": "2014-01-01T00:00:00Z"}, {"TripId": 1003, "Name": "Trip in Beijing", "StartsAt": "2014-02-01T00:00:00Z"}, {"TripId": 1007, "Name": "Honeymoon", "StartsAt": "2014-02-01T00:00:00Z"}]
a date of v2 with the types of $metadata (datetime'...' in $filter) (fixed result: real OData v2 Northwind service, services.odata.org)
admin
odata find "{\"url\": \"https://services.odata.org/V2/Northwind/Northwind.svc\"}" "Orders" "{\"OrderDate\": {\"$lt\": \"1996-07-06\"}}" "{\"select\": \"OrderID,OrderDate,ShipCity\", \"use_metadata\": true}"
mentdb
[{"OrderID": 10248, "OrderDate": "1996-07-04T00:00:00Z", "ShipCity": "Reims"}, {"OrderID": 10249, "OrderDate": "1996-07-05T00:00:00Z", "ShipCity": "Münster"}]
contains (substringof in v2), $or, top and skip (fixed result: real OData v2 Northwind service, services.odata.org)
admin
odata find "{\"url\": \"https://services.odata.org/V2/Northwind/Northwind.svc\"}" "Customers" "{\"$or\": [{\"Country\": \"France\"}, {\"Country\": \"Belgium\"}], \"CompanyName\": {\"$contains\": \"s\"}}" "{\"select\": [\"CustomerID\", \"CompanyName\", \"City\"], \"orderby\": \"CustomerID\", \"top\": 3, \"skip\": 1}"
mentdb
[{"CustomerID": "FOLIG", "CompanyName": "Folies gourmandes", "City": "Lille"}, {"CustomerID": "FRANR", "CompanyName": "France restauration", "City": "Nantes"}, {"CustomerID": "LAMAI", "CompanyName": "La maison d'Asie", "City": "Toulouse"}]
expand and raw_filter (fixed result: real OData v2 reference service, services.odata.org)
admin
odata find "{\"url\": \"https://services.odata.org/V2/(S(mentdbv2examples))/OData/OData.svc\"}" "Products" "{}" "{\"raw_filter\": \"Price gt 20\", \"expand\": \"Category\", \"select\": \"ID,Name,Price,Category/Name\"}"
mentdb
[{"Category": {"Name": "Beverages"}, "ID": 2, "Name": "Vint soda", "Price": "20.9"}, {"Category": {"Name": "Beverages"}, "ID": 4, "Name": "Fruit Punch", "Price": "22.99"}, {"Category": {"Name": "Beverages"}, "ID": 5, "Name": "Cranberry Juice", "Price": "22.8"}, {"Category": {"Name": "Electronics"}, "ID": 7, "Name": "DVD Player", "Price": "35.88"}, {"Category": {"Name": "Electronics"}, "ID": 8, "Name": "LCD HDTV", "Price": "1088.8"}]

odata get <config> <entity_set> <key>


Description

    One entity by key; null when it does not exist (when the entity set itself is not in the service document, it is an error: a typo is not taken for a missing key)

Parameters

    config:   The OData service as JSON: url (the service root, like https://host/sap/opu/odata/sap/API_BUSINESS_PARTNER, https://org.crm.dynamics.com/api/data/v9.2 or https://api.businesscentral.dynamics.com/v2.0///api/v2.0), version (auto: read from the service document; 2 or 4), the authentication: username and password (basic), token (bearer), or token_url, client_id, client_secret, scope, resource (OAuth2 client credentials, cached until its expiry), sap_client (3 digits, the sap-client parameter of every request), query (parameters added to every request, like {"sap-language": "EN"}), headers and secret_headers (extra headers, the second one reads the values from secrets), csrf (auto: the X-CSRF-Token is fetched when a write is refused with X-CSRF-Token: Required; true: fetched before the first write; false: never), allow_plain (false: credentials over http are refused unless the host is local), ca_file (a PEM file of a private CA), timeout_ms (30000), max_bytes (64 MB, the largest answer) - String - required
    entity_set:   The entity set (People), or a navigation path (People('russellwhyte')/Trips); inside a key, a / is written %2F (a valid %XX is kept as it is) and spaces are allowed - String - required
    key:   The key: a value (russellwhyte, 42; an integer with leading zeros like 0000001 stays a text, a GUID is an Edm.Guid in v4), a JSON string ("\"42\"" for a text key that looks like a number), or a JSON object for a composite key ({"OrderID": 10248, "ProductID": 11}) - String - required
admin
odata get "{\"url\": \"https://services.odata.org/V4/(S(mentdbv4examples))/TripPinServiceRW\"}" "Airports" "KSFO"
mentdb
{"IcaoCode": "KSFO", "Name": "San Francisco International Airport", "IataCode": "SFO", "Location": {"Address": "South McDonnell Road, San Francisco, CA 94128", "City": {"CountryRegion": "United States", "Name": "San Francisco", "Region": "California"}, "Loc": {"type": "Point", "coordinates": [-122.374722222222, 37.6188888888889], "crs": {"type": "name", "properties": {"name": "EPSG:4326"}}}}}
a composite key (fixed result: real OData v2 Northwind service, services.odata.org)
admin
odata get "{\"url\": \"https://services.odata.org/V2/Northwind/Northwind.svc\"}" "Order_Details" "{\"OrderID\": 10248, \"ProductID\": 11}"
mentdb
{"OrderID": 10248, "ProductID": 11, "UnitPrice": "14.0000", "Quantity": 12, "Discount": 0}
no such key (fixed result: real OData v4 reference service TripPin, services.odata.org)
admin
odata get "{\"url\": \"https://services.odata.org/V4/(S(mentdbv4examples))/TripPinServiceRW\"}" "People" "nobody"
mentdb
null

odata get <config> <entity_set> <key> <options_json>


Description

    Get with options: select, expand, params, keep_annotations (to read @odata.etag or __metadata), key_type (the Edm type of a single key), types (the Edm type of a property: {"ID": "Edm.Guid", "Born": "Edm.DateTime"}), use_metadata (true: the types and keys read from $metadata, cached 10 minutes)

Parameters

    config:   The OData service as JSON: url (the service root, like https://host/sap/opu/odata/sap/API_BUSINESS_PARTNER, https://org.crm.dynamics.com/api/data/v9.2 or https://api.businesscentral.dynamics.com/v2.0///api/v2.0), version (auto: read from the service document; 2 or 4), the authentication: username and password (basic), token (bearer), or token_url, client_id, client_secret, scope, resource (OAuth2 client credentials, cached until its expiry), sap_client (3 digits, the sap-client parameter of every request), query (parameters added to every request, like {"sap-language": "EN"}), headers and secret_headers (extra headers, the second one reads the values from secrets), csrf (auto: the X-CSRF-Token is fetched when a write is refused with X-CSRF-Token: Required; true: fetched before the first write; false: never), allow_plain (false: credentials over http are refused unless the host is local), ca_file (a PEM file of a private CA), timeout_ms (30000), max_bytes (64 MB, the largest answer) - String - required
    entity_set:   The entity set (People), or a navigation path (People('russellwhyte')/Trips); inside a key, a / is written %2F (a valid %XX is kept as it is) and spaces are allowed - String - required
    key:   The key: a value (russellwhyte, 42; an integer with leading zeros like 0000001 stays a text, a GUID is an Edm.Guid in v4), a JSON string ("\"42\"" for a text key that looks like a number), or a JSON object for a composite key ({"OrderID": 10248, "ProductID": 11}) - String - required
    options_json:   The options - String - required
admin
odata get "{\"url\": \"https://services.odata.org/V4/(S(mentdbv4examples))/TripPinServiceRW\"}" "People" "russellwhyte" "{\"select\": \"UserName,FirstName\", \"keep_annotations\": true}"
mentdb
{"@odata.context": "http://services.odata.org/V4/(S(mentdbv4examples))/TripPinServiceRW/$metadata#People(UserName,FirstName)/$entity", "@odata.id": "http://services.odata.org/V4/(S(mentdbv4examples))/TripPinServiceRW/People('russellwhyte')", "@odata.etag": "W/\"08DF44C731752294\"", "@odata.editLink": "http://services.odata.org/V4/(S(mentdbv4examples))/TripPinServiceRW/People('russellwhyte')", "UserName": "russellwhyte", "FirstName": "Russell"}
with its category (v2) (fixed result: real OData v2 reference service, services.odata.org)
admin
odata get "{\"url\": \"https://services.odata.org/V2/(S(mentdbv2examples))/OData/OData.svc\"}" "Products" "1" "{\"expand\": \"Category\"}"
mentdb
{"Category": {"ID": 1, "Name": "Beverages"}, "ID": 1, "Name": "Milk", "Description": "Low fat milk", "ReleaseDate": "1995-10-01T00:00:00Z", "DiscontinuedDate": null, "Rating": 3, "Price": "3.5"}

odata count <config> <entity_set>


Description

    The number of entities of an entity set ($count)

Parameters

    config:   The OData service as JSON: url (the service root, like https://host/sap/opu/odata/sap/API_BUSINESS_PARTNER, https://org.crm.dynamics.com/api/data/v9.2 or https://api.businesscentral.dynamics.com/v2.0///api/v2.0), version (auto: read from the service document; 2 or 4), the authentication: username and password (basic), token (bearer), or token_url, client_id, client_secret, scope, resource (OAuth2 client credentials, cached until its expiry), sap_client (3 digits, the sap-client parameter of every request), query (parameters added to every request, like {"sap-language": "EN"}), headers and secret_headers (extra headers, the second one reads the values from secrets), csrf (auto: the X-CSRF-Token is fetched when a write is refused with X-CSRF-Token: Required; true: fetched before the first write; false: never), allow_plain (false: credentials over http are refused unless the host is local), ca_file (a PEM file of a private CA), timeout_ms (30000), max_bytes (64 MB, the largest answer) - String - required
    entity_set:   The entity set (People), or a navigation path (People('russellwhyte')/Trips); inside a key, a / is written %2F (a valid %XX is kept as it is) and spaces are allowed - String - required
admin
odata count "{\"url\": \"https://services.odata.org/V4/(S(mentdbv4examples))/TripPinServiceRW\"}" "People"
mentdb
20

odata count <config> <entity_set> <filter_json>


Description

    The number of entities of a filter

Parameters

    config:   The OData service as JSON: url (the service root, like https://host/sap/opu/odata/sap/API_BUSINESS_PARTNER, https://org.crm.dynamics.com/api/data/v9.2 or https://api.businesscentral.dynamics.com/v2.0///api/v2.0), version (auto: read from the service document; 2 or 4), the authentication: username and password (basic), token (bearer), or token_url, client_id, client_secret, scope, resource (OAuth2 client credentials, cached until its expiry), sap_client (3 digits, the sap-client parameter of every request), query (parameters added to every request, like {"sap-language": "EN"}), headers and secret_headers (extra headers, the second one reads the values from secrets), csrf (auto: the X-CSRF-Token is fetched when a write is refused with X-CSRF-Token: Required; true: fetched before the first write; false: never), allow_plain (false: credentials over http are refused unless the host is local), ca_file (a PEM file of a private CA), timeout_ms (30000), max_bytes (64 MB, the largest answer) - String - required
    entity_set:   The entity set (People), or a navigation path (People('russellwhyte')/Trips); inside a key, a / is written %2F (a valid %XX is kept as it is) and spaces are allowed - String - required
    filter_json:   The filter as a JSON object, written as $filter: {"City": "Paris"} (eq), {"Age": {"$gte": 18}} with $eq $ne $gt $gte $lt $lte $in $nin $contains $icontains $startswith $endswith $exists, $and / $or (arrays of filters), $not; a path with / or . for a complex property (Address/City); {} for every entity. Texts are quoted (O''Neil), numbers and booleans written as such (a large double stays in exponent form; an Edm.Decimal has 100 digits at most; invalid dates like 2024-02-30 are refused); other types (Guid, DateTime, Decimal, Int64 of v2, enumerations of v4) need the option types or use_metadata - String - required
admin
odata count "{\"url\": \"https://services.odata.org/V2/Northwind/Northwind.svc\"}" "Customers" "{\"Country\": \"France\"}"
mentdb
11

odata count <config> <entity_set> <filter_json> <options_json>


Description

    Count with options: raw_filter, search, params, types (the Edm type of a property: {"ID": "Edm.Guid", "Born": "Edm.DateTime"}), use_metadata (true: the types and keys read from $metadata, cached 10 minutes). A server which refuses $filter on /$count is asked again with $count=true (v4) or $inlinecount (v2)

Parameters

    config:   The OData service as JSON: url (the service root, like https://host/sap/opu/odata/sap/API_BUSINESS_PARTNER, https://org.crm.dynamics.com/api/data/v9.2 or https://api.businesscentral.dynamics.com/v2.0///api/v2.0), version (auto: read from the service document; 2 or 4), the authentication: username and password (basic), token (bearer), or token_url, client_id, client_secret, scope, resource (OAuth2 client credentials, cached until its expiry), sap_client (3 digits, the sap-client parameter of every request), query (parameters added to every request, like {"sap-language": "EN"}), headers and secret_headers (extra headers, the second one reads the values from secrets), csrf (auto: the X-CSRF-Token is fetched when a write is refused with X-CSRF-Token: Required; true: fetched before the first write; false: never), allow_plain (false: credentials over http are refused unless the host is local), ca_file (a PEM file of a private CA), timeout_ms (30000), max_bytes (64 MB, the largest answer) - String - required
    entity_set:   The entity set (People), or a navigation path (People('russellwhyte')/Trips); inside a key, a / is written %2F (a valid %XX is kept as it is) and spaces are allowed - String - required
    filter_json:   The filter as a JSON object, written as $filter: {"City": "Paris"} (eq), {"Age": {"$gte": 18}} with $eq $ne $gt $gte $lt $lte $in $nin $contains $icontains $startswith $endswith $exists, $and / $or (arrays of filters), $not; a path with / or . for a complex property (Address/City); {} for every entity. Texts are quoted (O''Neil), numbers and booleans written as such (a large double stays in exponent form; an Edm.Decimal has 100 digits at most; invalid dates like 2024-02-30 are refused); other types (Guid, DateTime, Decimal, Int64 of v2, enumerations of v4) need the option types or use_metadata - String - required
    options_json:   The options - String - required
admin
odata count "{\"url\": \"https://services.odata.org/V4/(S(mentdbv4examples))/TripPinServiceRW\"}" "People" "{\"Gender\": \"Female\"}" "{\"use_metadata\": true}"
mentdb
10

odata insert <config> <entity_set> <rows_json>


Description

    Create entities from MQL rows (a JSON array of objects, or one object): one POST per row. A row refused by the service is an error of the list, the others are created. Returns {inserted, errors: [{row, status, error}]}

Parameters

    config:   The OData service as JSON: url (the service root, like https://host/sap/opu/odata/sap/API_BUSINESS_PARTNER, https://org.crm.dynamics.com/api/data/v9.2 or https://api.businesscentral.dynamics.com/v2.0///api/v2.0), version (auto: read from the service document; 2 or 4), the authentication: username and password (basic), token (bearer), or token_url, client_id, client_secret, scope, resource (OAuth2 client credentials, cached until its expiry), sap_client (3 digits, the sap-client parameter of every request), query (parameters added to every request, like {"sap-language": "EN"}), headers and secret_headers (extra headers, the second one reads the values from secrets), csrf (auto: the X-CSRF-Token is fetched when a write is refused with X-CSRF-Token: Required; true: fetched before the first write; false: never), allow_plain (false: credentials over http are refused unless the host is local), ca_file (a PEM file of a private CA), timeout_ms (30000), max_bytes (64 MB, the largest answer) - String - required
    entity_set:   The entity set (People), or a navigation path (People('russellwhyte')/Trips); inside a key, a / is written %2F (a valid %XX is kept as it is) and spaces are allowed - String - required
    rows_json:   The rows - String - required
admin
odata insert "{\"url\": \"https://services.odata.org/V4/(S(mentdbv4examples))/TripPinServiceRW\"}" "People" "[{\"UserName\": \"zoemartin\", \"FirstName\": \"Zoé\", \"LastName\": \"Martin\", \"Emails\": [\"zoe@example.com\"], \"AddressInfo\": []}, {\"UserName\": \"leapayet\", \"FirstName\": \"Léa\", \"LastName\": \"Payet\", \"Emails\": [], \"AddressInfo\": []}]"
mentdb
{"inserted": 2, "errors": []}

odata insert <config> <entity_set> <rows_json> <options_json>


Description

    Insert with options: batch (true: rows sent in $batch requests, each row in its own change set so that the errors stay per row), batch_size (100), return_rows (true: the created entities in rows), keep_annotations, types (the Edm type of a property: {"ID": "Edm.Guid", "Born": "Edm.DateTime"}), use_metadata (true: the types and keys read from $metadata, cached 10 minutes) (v2: ISO dates are sent as /Date(...)/ and Int64 / Decimal as texts)

Parameters

    config:   The OData service as JSON: url (the service root, like https://host/sap/opu/odata/sap/API_BUSINESS_PARTNER, https://org.crm.dynamics.com/api/data/v9.2 or https://api.businesscentral.dynamics.com/v2.0///api/v2.0), version (auto: read from the service document; 2 or 4), the authentication: username and password (basic), token (bearer), or token_url, client_id, client_secret, scope, resource (OAuth2 client credentials, cached until its expiry), sap_client (3 digits, the sap-client parameter of every request), query (parameters added to every request, like {"sap-language": "EN"}), headers and secret_headers (extra headers, the second one reads the values from secrets), csrf (auto: the X-CSRF-Token is fetched when a write is refused with X-CSRF-Token: Required; true: fetched before the first write; false: never), allow_plain (false: credentials over http are refused unless the host is local), ca_file (a PEM file of a private CA), timeout_ms (30000), max_bytes (64 MB, the largest answer) - String - required
    entity_set:   The entity set (People), or a navigation path (People('russellwhyte')/Trips); inside a key, a / is written %2F (a valid %XX is kept as it is) and spaces are allowed - String - required
    rows_json:   The rows - String - required
    options_json:   The options - String - required
admin
odata insert "{\"url\": \"https://services.odata.org/V2/(S(mentdbv2examples))/OData/OData.svc\"}" "Products" "[{\"ID\": 100, \"Name\": \"Vanilla\", \"Description\": \"Bourbon vanilla\", \"ReleaseDate\": \"2024-05-31\", \"Rating\": 5, \"Price\": 12.5}]" "{\"use_metadata\": true, \"return_rows\": true}"
mentdb
{"inserted": 1, "errors": [], "rows": [{"ID": 100, "Name": "Vanilla", "Description": "Bourbon vanilla", "ReleaseDate": "2024-05-31T00:00:00Z", "DiscontinuedDate": null, "Rating": 5, "Price": "12.5"}]}
in one $batch (fixed result: real OData v4 reference service TripPin, services.odata.org)
admin
odata insert "{\"url\": \"https://services.odata.org/V4/(S(mentdbv4examples))/TripPinServiceRW\"}" "People" "[{\"UserName\": \"annahoarau\", \"FirstName\": \"Anna\", \"LastName\": \"Hoarau\", \"Emails\": [], \"AddressInfo\": []}, {\"UserName\": \"paulgrondin\", \"FirstName\": \"Paul\", \"LastName\": \"Grondin\", \"Emails\": [], \"AddressInfo\": []}]" "{\"batch\": true}"
mentdb
{"inserted": 2, "errors": []}

odata update <config> <entity_set> <key> <changes_json>


Description

    Change properties of one entity by key (PATCH in v4, MERGE in v2). Returns {updated} (0 when the key does not exist) and the new etag when the service sends one

Parameters

    config:   The OData service as JSON: url (the service root, like https://host/sap/opu/odata/sap/API_BUSINESS_PARTNER, https://org.crm.dynamics.com/api/data/v9.2 or https://api.businesscentral.dynamics.com/v2.0///api/v2.0), version (auto: read from the service document; 2 or 4), the authentication: username and password (basic), token (bearer), or token_url, client_id, client_secret, scope, resource (OAuth2 client credentials, cached until its expiry), sap_client (3 digits, the sap-client parameter of every request), query (parameters added to every request, like {"sap-language": "EN"}), headers and secret_headers (extra headers, the second one reads the values from secrets), csrf (auto: the X-CSRF-Token is fetched when a write is refused with X-CSRF-Token: Required; true: fetched before the first write; false: never), allow_plain (false: credentials over http are refused unless the host is local), ca_file (a PEM file of a private CA), timeout_ms (30000), max_bytes (64 MB, the largest answer) - String - required
    entity_set:   The entity set (People), or a navigation path (People('russellwhyte')/Trips); inside a key, a / is written %2F (a valid %XX is kept as it is) and spaces are allowed - String - required
    key:   The key: a value (russellwhyte, 42; an integer with leading zeros like 0000001 stays a text, a GUID is an Edm.Guid in v4), a JSON string ("\"42\"" for a text key that looks like a number), or a JSON object for a composite key ({"OrderID": 10248, "ProductID": 11}) - String - required
    changes_json:   The properties to change as a JSON object - String - required
admin
odata update "{\"url\": \"https://services.odata.org/V2/(S(mentdbv2examples))/OData/OData.svc\"}" "Products" "100" "{\"Price\": \"13.9\", \"Rating\": 4}"
mentdb
{"updated": 1}

odata update <config> <entity_set> <key> <changes_json> <options_json>


Description

    Update with options: etag (If-Match: the @odata.etag read before, or * for any version; 412 when the entity changed), method (PATCH, MERGE or PUT), x_http_method (POST with X-HTTP-Method), key_type, types (the Edm type of a property: {"ID": "Edm.Guid", "Born": "Edm.DateTime"}), use_metadata (true: the types and keys read from $metadata, cached 10 minutes)

Parameters

    config:   The OData service as JSON: url (the service root, like https://host/sap/opu/odata/sap/API_BUSINESS_PARTNER, https://org.crm.dynamics.com/api/data/v9.2 or https://api.businesscentral.dynamics.com/v2.0///api/v2.0), version (auto: read from the service document; 2 or 4), the authentication: username and password (basic), token (bearer), or token_url, client_id, client_secret, scope, resource (OAuth2 client credentials, cached until its expiry), sap_client (3 digits, the sap-client parameter of every request), query (parameters added to every request, like {"sap-language": "EN"}), headers and secret_headers (extra headers, the second one reads the values from secrets), csrf (auto: the X-CSRF-Token is fetched when a write is refused with X-CSRF-Token: Required; true: fetched before the first write; false: never), allow_plain (false: credentials over http are refused unless the host is local), ca_file (a PEM file of a private CA), timeout_ms (30000), max_bytes (64 MB, the largest answer) - String - required
    entity_set:   The entity set (People), or a navigation path (People('russellwhyte')/Trips); inside a key, a / is written %2F (a valid %XX is kept as it is) and spaces are allowed - String - required
    key:   The key: a value (russellwhyte, 42; an integer with leading zeros like 0000001 stays a text, a GUID is an Edm.Guid in v4), a JSON string ("\"42\"" for a text key that looks like a number), or a JSON object for a composite key ({"OrderID": 10248, "ProductID": 11}) - String - required
    changes_json:   The properties to change - String - required
    options_json:   The options - String - required
admin
odata update "{\"url\": \"https://services.odata.org/V4/(S(mentdbv4examples))/TripPinServiceRW\"}" "People" "zoemartin" "{\"LastName\": \"Martin-Hoarau\"}"
mentdb
ERROR: Sorry, an error appears (the OData service requires an ETag (HTTP 428): give the option etag (the @odata.etag of the entity, or *)).
any version (*) (fixed result: real OData v4 reference service TripPin, services.odata.org)
admin
odata update "{\"url\": \"https://services.odata.org/V4/(S(mentdbv4examples))/TripPinServiceRW\"}" "People" "zoemartin" "{\"LastName\": \"Martin-Hoarau\"}" "{\"etag\": \"*\"}"
mentdb
{"updated": 1, "etag": "W/\"08DF44C73AE0A43C\""}
an old ETag (fixed result: real OData v4 reference service TripPin, services.odata.org)
admin
odata update "{\"url\": \"https://services.odata.org/V4/(S(mentdbv4examples))/TripPinServiceRW\"}" "People" "zoemartin" "{\"LastName\": \"X\"}" "{\"etag\": \"W/\\"08D000000000000\\"\"}"
mentdb
ERROR: Sorry, an error appears (the entity changed since it was read (HTTP 412, ETag mismatch)).

odata delete <config> <entity_set> <key>


Description

    Delete one entity by key. Returns {deleted} (0 when the key does not exist)

Parameters

    config:   The OData service as JSON: url (the service root, like https://host/sap/opu/odata/sap/API_BUSINESS_PARTNER, https://org.crm.dynamics.com/api/data/v9.2 or https://api.businesscentral.dynamics.com/v2.0///api/v2.0), version (auto: read from the service document; 2 or 4), the authentication: username and password (basic), token (bearer), or token_url, client_id, client_secret, scope, resource (OAuth2 client credentials, cached until its expiry), sap_client (3 digits, the sap-client parameter of every request), query (parameters added to every request, like {"sap-language": "EN"}), headers and secret_headers (extra headers, the second one reads the values from secrets), csrf (auto: the X-CSRF-Token is fetched when a write is refused with X-CSRF-Token: Required; true: fetched before the first write; false: never), allow_plain (false: credentials over http are refused unless the host is local), ca_file (a PEM file of a private CA), timeout_ms (30000), max_bytes (64 MB, the largest answer) - String - required
    entity_set:   The entity set (People), or a navigation path (People('russellwhyte')/Trips); inside a key, a / is written %2F (a valid %XX is kept as it is) and spaces are allowed - String - required
    key:   The key: a value (russellwhyte, 42; an integer with leading zeros like 0000001 stays a text, a GUID is an Edm.Guid in v4), a JSON string ("\"42\"" for a text key that looks like a number), or a JSON object for a composite key ({"OrderID": 10248, "ProductID": 11}) - String - required
admin
odata delete "{\"url\": \"https://services.odata.org/V2/(S(mentdbv2examples))/OData/OData.svc\"}" "Products" "100"
mentdb
{"deleted": 1}
no such key (fixed result: real OData v2 reference service, services.odata.org)
admin
odata delete "{\"url\": \"https://services.odata.org/V2/(S(mentdbv2examples))/OData/OData.svc\"}" "Products" "12345"
mentdb
{"deleted": 0}

odata delete <config> <entity_set> <key> <options_json>


Description

    Delete with options: etag (If-Match), x_http_method, key_type, types (the Edm type of a property: {"ID": "Edm.Guid", "Born": "Edm.DateTime"}), use_metadata (true: the types and keys read from $metadata, cached 10 minutes)

Parameters

    config:   The OData service as JSON: url (the service root, like https://host/sap/opu/odata/sap/API_BUSINESS_PARTNER, https://org.crm.dynamics.com/api/data/v9.2 or https://api.businesscentral.dynamics.com/v2.0///api/v2.0), version (auto: read from the service document; 2 or 4), the authentication: username and password (basic), token (bearer), or token_url, client_id, client_secret, scope, resource (OAuth2 client credentials, cached until its expiry), sap_client (3 digits, the sap-client parameter of every request), query (parameters added to every request, like {"sap-language": "EN"}), headers and secret_headers (extra headers, the second one reads the values from secrets), csrf (auto: the X-CSRF-Token is fetched when a write is refused with X-CSRF-Token: Required; true: fetched before the first write; false: never), allow_plain (false: credentials over http are refused unless the host is local), ca_file (a PEM file of a private CA), timeout_ms (30000), max_bytes (64 MB, the largest answer) - String - required
    entity_set:   The entity set (People), or a navigation path (People('russellwhyte')/Trips); inside a key, a / is written %2F (a valid %XX is kept as it is) and spaces are allowed - String - required
    key:   The key: a value (russellwhyte, 42; an integer with leading zeros like 0000001 stays a text, a GUID is an Edm.Guid in v4), a JSON string ("\"42\"" for a text key that looks like a number), or a JSON object for a composite key ({"OrderID": 10248, "ProductID": 11}) - String - required
    options_json:   The options - String - required
admin
odata delete "{\"url\": \"https://services.odata.org/V4/(S(mentdbv4examples))/TripPinServiceRW\"}" "People" "leapayet" "{\"etag\": \"*\"}"
mentdb
{"deleted": 1}

odata call <config> <name>


Description

    Call a function without parameter (a function import, or a bound function with its path): the result as rows, an object or a value

Parameters

    config:   The OData service as JSON: url (the service root, like https://host/sap/opu/odata/sap/API_BUSINESS_PARTNER, https://org.crm.dynamics.com/api/data/v9.2 or https://api.businesscentral.dynamics.com/v2.0///api/v2.0), version (auto: read from the service document; 2 or 4), the authentication: username and password (basic), token (bearer), or token_url, client_id, client_secret, scope, resource (OAuth2 client credentials, cached until its expiry), sap_client (3 digits, the sap-client parameter of every request), query (parameters added to every request, like {"sap-language": "EN"}), headers and secret_headers (extra headers, the second one reads the values from secrets), csrf (auto: the X-CSRF-Token is fetched when a write is refused with X-CSRF-Token: Required; true: fetched before the first write; false: never), allow_plain (false: credentials over http are refused unless the host is local), ca_file (a PEM file of a private CA), timeout_ms (30000), max_bytes (64 MB, the largest answer) - String - required
    name:   The function import, or a path to a bound function or action - String - required
admin
odata call "{\"url\": \"https://services.odata.org/V4/(S(mentdbv4examples))/TripPinServiceRW\"}" "People('russellwhyte')/Microsoft.OData.SampleService.Models.TripPin.GetFavoriteAirline"
mentdb
{"AirlineCode": "AA", "Name": "American Airlines"}

odata call <config> <name> <params_json>


Description

    Call a function with parameters: v4 writes them in the URL (Name(lat=33,lon=-118)), v2 in the query (?rating=4)

Parameters

    config:   The OData service as JSON: url (the service root, like https://host/sap/opu/odata/sap/API_BUSINESS_PARTNER, https://org.crm.dynamics.com/api/data/v9.2 or https://api.businesscentral.dynamics.com/v2.0///api/v2.0), version (auto: read from the service document; 2 or 4), the authentication: username and password (basic), token (bearer), or token_url, client_id, client_secret, scope, resource (OAuth2 client credentials, cached until its expiry), sap_client (3 digits, the sap-client parameter of every request), query (parameters added to every request, like {"sap-language": "EN"}), headers and secret_headers (extra headers, the second one reads the values from secrets), csrf (auto: the X-CSRF-Token is fetched when a write is refused with X-CSRF-Token: Required; true: fetched before the first write; false: never), allow_plain (false: credentials over http are refused unless the host is local), ca_file (a PEM file of a private CA), timeout_ms (30000), max_bytes (64 MB, the largest answer) - String - required
    name:   The function - String - required
    params_json:   The parameters as a JSON object - String - required
admin
odata call "{\"url\": \"https://services.odata.org/V4/(S(mentdbv4examples))/TripPinServiceRW\"}" "GetNearestAirport" "{\"lat\": 33, \"lon\": -118}"
mentdb
{"IcaoCode": "KLAX", "Name": "Los Angeles International Airport", "IataCode": "LAX", "Location": {"Address": "1 World Way, Los Angeles, CA, 90045", "City": {"CountryRegion": "United States", "Name": "Los Angeles", "Region": "California"}, "Loc": {"type": "Point", "coordinates": [-118.408055555556, 33.9425], "crs": {"type": "name", "properties": {"name": "EPSG:4326"}}}}}
a function import of v2 (fixed result: real OData v2 reference service, services.odata.org)
admin
odata call "{\"url\": \"https://services.odata.org/V2/(S(mentdbv2examples))/OData/OData.svc\"}" "GetProductsByRating" "{\"rating\": 4}"
mentdb
[{"ID": 0, "Name": "Bread", "Description": "Whole grain bread", "ReleaseDate": "1992-01-01T00:00:00Z", "DiscontinuedDate": null, "Rating": 4, "Price": "2.5"}]

odata call <config> <name> <params_json> <options_json>


Description

    Call with options: kind (function or action: an action is a POST with the parameters in a JSON body), method (GET or POST), use_metadata (the kind, the HTTP method of v2 and the parameter types from $metadata), types, params, keep_annotations. An action without result returns {status}

Parameters

    config:   The OData service as JSON: url (the service root, like https://host/sap/opu/odata/sap/API_BUSINESS_PARTNER, https://org.crm.dynamics.com/api/data/v9.2 or https://api.businesscentral.dynamics.com/v2.0///api/v2.0), version (auto: read from the service document; 2 or 4), the authentication: username and password (basic), token (bearer), or token_url, client_id, client_secret, scope, resource (OAuth2 client credentials, cached until its expiry), sap_client (3 digits, the sap-client parameter of every request), query (parameters added to every request, like {"sap-language": "EN"}), headers and secret_headers (extra headers, the second one reads the values from secrets), csrf (auto: the X-CSRF-Token is fetched when a write is refused with X-CSRF-Token: Required; true: fetched before the first write; false: never), allow_plain (false: credentials over http are refused unless the host is local), ca_file (a PEM file of a private CA), timeout_ms (30000), max_bytes (64 MB, the largest answer) - String - required
    name:   The function or action - String - required
    params_json:   The parameters, empty for none - String - required
    options_json:   The options - String - required
admin
odata call "{\"url\": \"https://services.odata.org/V4/(S(mentdbv4examples))/TripPinServiceRW\"}" "People('russellwhyte')/Microsoft.OData.SampleService.Models.TripPin.ShareTrip" "{\"userName\": \"scottketchum\", \"tripId\": 0}" "{\"kind\": \"action\"}"
mentdb
{"status": 204}
the action that resets the sandbox (fixed result: real OData v4 reference service TripPin, services.odata.org)
admin
odata call "{\"url\": \"https://services.odata.org/V4/(S(mentdbv4examples))/TripPinServiceRW\"}" "ResetDataSource" "" "{\"kind\": \"action\"}"
mentdb
{"status": 204}

odata batch <config> <requests_json>


Description

    Send several requests in one $batch (multipart/mixed): [{method (GET, POST, PUT, PATCH, MERGE, DELETE), path (relative to the service root, with its query), body (JSON), headers}]. The consecutive writes go in one change set (all or nothing on the server); a request of a change set can refer to an entity created before it with $1, $2... (its position). Returns rows {index, method, path, status, body, error}

Parameters

    config:   The OData service as JSON: url (the service root, like https://host/sap/opu/odata/sap/API_BUSINESS_PARTNER, https://org.crm.dynamics.com/api/data/v9.2 or https://api.businesscentral.dynamics.com/v2.0///api/v2.0), version (auto: read from the service document; 2 or 4), the authentication: username and password (basic), token (bearer), or token_url, client_id, client_secret, scope, resource (OAuth2 client credentials, cached until its expiry), sap_client (3 digits, the sap-client parameter of every request), query (parameters added to every request, like {"sap-language": "EN"}), headers and secret_headers (extra headers, the second one reads the values from secrets), csrf (auto: the X-CSRF-Token is fetched when a write is refused with X-CSRF-Token: Required; true: fetched before the first write; false: never), allow_plain (false: credentials over http are refused unless the host is local), ca_file (a PEM file of a private CA), timeout_ms (30000), max_bytes (64 MB, the largest answer) - String - required
    requests_json:   The requests as a JSON array - String - required
admin
odata batch "{\"url\": \"https://services.odata.org/V4/(S(mentdbv4examples))/TripPinServiceRW\"}" "[{\"method\": \"GET\", \"path\": \"People('russellwhyte')?$select=UserName,FirstName\"}, {\"method\": \"POST\", \"path\": \"People\", \"body\": {\"UserName\": \"marcpayet\", \"FirstName\": \"Marc\", \"LastName\": \"Payet\", \"Emails\": [], \"AddressInfo\": []}}, {\"method\": \"PATCH\", \"path\": \"People('marcpayet')\", \"body\": {\"FirstName\": \"Marco\"}, \"headers\": {\"If-Match\": \"*\"}}, {\"method\": \"GET\", \"path\": \"People/$count\"}]"
mentdb
[{"index": 0, "method": "GET", "path": "People('russellwhyte')?$select=UserName,FirstName", "status": 200, "body": {"UserName": "russellwhyte", "FirstName": "Russell"}, "error": null}, {"index": 1, "method": "POST", "path": "People", "status": 201, "body": {"UserName": "marcpayet", "FirstName": "Marc", "LastName": "Payet", "Emails": [], "AddressInfo": [], "Gender": "Male", "Concurrency": 639305294632106842}, "error": null}, {"index": 2, "method": "PATCH", "path": "People('marcpayet')", "status": 204, "body": null, "error": null}, {"index": 3, "method": "GET", "path": "People/$count", "status": 200, "body": 21, "error": null}]

odata batch <config> <requests_json> <options_json>


Description

    A $batch with options: atomic (true; false: one change set per write, so that a failure stops only its own request), absolute_paths (true for v4: request lines with the full URL, as Dataverse and Business Central expect; false for v2: relative, as SAP Gateway expects), keep_annotations

Parameters

    config:   The OData service as JSON: url (the service root, like https://host/sap/opu/odata/sap/API_BUSINESS_PARTNER, https://org.crm.dynamics.com/api/data/v9.2 or https://api.businesscentral.dynamics.com/v2.0///api/v2.0), version (auto: read from the service document; 2 or 4), the authentication: username and password (basic), token (bearer), or token_url, client_id, client_secret, scope, resource (OAuth2 client credentials, cached until its expiry), sap_client (3 digits, the sap-client parameter of every request), query (parameters added to every request, like {"sap-language": "EN"}), headers and secret_headers (extra headers, the second one reads the values from secrets), csrf (auto: the X-CSRF-Token is fetched when a write is refused with X-CSRF-Token: Required; true: fetched before the first write; false: never), allow_plain (false: credentials over http are refused unless the host is local), ca_file (a PEM file of a private CA), timeout_ms (30000), max_bytes (64 MB, the largest answer) - String - required
    requests_json:   The requests - String - required
    options_json:   The options - String - required
admin
odata batch "{\"url\": \"https://services.odata.org/V2/(S(mentdbv2examples))/OData/OData.svc\"}" "[{\"method\": \"POST\", \"path\": \"Products\", \"body\": {\"ID\": 101, \"Name\": \"Lychee\", \"Rating\": 4, \"Price\": \"3.2\", \"ReleaseDate\": \"/Date(1717200000000)/\"}}, {\"method\": \"GET\", \"path\": \"Products(101)?$select=ID,Name,ReleaseDate\"}, {\"method\": \"MERGE\", \"path\": \"Products(999)\", \"body\": {\"Rating\": 5}}, {\"method\": \"DELETE\", \"path\": \"Products(101)\"}]" "{\"atomic\": false}"
mentdb
[{"index": 0, "method": "POST", "path": "Products", "status": 201, "body": {"ID": 101, "Name": "Lychee", "Description": null, "ReleaseDate": "2024-06-01T00:00:00Z", "DiscontinuedDate": null, "Rating": 4, "Price": "3.2"}, "error": null}, {"index": 1, "method": "GET", "path": "Products(101)?$select=ID,Name,ReleaseDate", "status": 200, "body": {"ID": 101, "Name": "Lychee", "ReleaseDate": "2024-06-01T00:00:00Z"}, "error": null}, {"index": 2, "method": "MERGE", "path": "Products(999)", "status": 404, "body": null, "error": "HTTP 404: Resource not found for the segment 'Products'."}, {"index": 3, "method": "DELETE", "path": "Products(101)", "status": 204, "body": null, "error": null}]

odata request <config> <method> <path>


Description

    A raw request relative to the service root (escape hatch): the body of the answer as it is ({status} when it is empty). The configuration (authentication, sap_client, CSRF token for the writes) applies

Parameters

    config:   The OData service as JSON: url (the service root, like https://host/sap/opu/odata/sap/API_BUSINESS_PARTNER, https://org.crm.dynamics.com/api/data/v9.2 or https://api.businesscentral.dynamics.com/v2.0///api/v2.0), version (auto: read from the service document; 2 or 4), the authentication: username and password (basic), token (bearer), or token_url, client_id, client_secret, scope, resource (OAuth2 client credentials, cached until its expiry), sap_client (3 digits, the sap-client parameter of every request), query (parameters added to every request, like {"sap-language": "EN"}), headers and secret_headers (extra headers, the second one reads the values from secrets), csrf (auto: the X-CSRF-Token is fetched when a write is refused with X-CSRF-Token: Required; true: fetched before the first write; false: never), allow_plain (false: credentials over http are refused unless the host is local), ca_file (a PEM file of a private CA), timeout_ms (30000), max_bytes (64 MB, the largest answer) - String - required
    method:   GET, POST, PUT, PATCH, MERGE, DELETE or HEAD - String - required
    path:   The path and its query, like People?$top=2 (.. refused) - String - required
admin
odata request "{\"url\": \"https://services.odata.org/V4/(S(mentdbv4examples))/TripPinServiceRW\"}" "GET" "People('russellwhyte')/FirstName"
mentdb
{"@odata.context":"http://services.odata.org/V4/(S(mentdbv4examples))/TripPinServiceRW/$metadata#People('russellwhyte')/FirstName","value":"Russell"}

odata request <config> <method> <path> <body_json>


Description

    A raw request with a JSON body

Parameters

    config:   The OData service as JSON: url (the service root, like https://host/sap/opu/odata/sap/API_BUSINESS_PARTNER, https://org.crm.dynamics.com/api/data/v9.2 or https://api.businesscentral.dynamics.com/v2.0///api/v2.0), version (auto: read from the service document; 2 or 4), the authentication: username and password (basic), token (bearer), or token_url, client_id, client_secret, scope, resource (OAuth2 client credentials, cached until its expiry), sap_client (3 digits, the sap-client parameter of every request), query (parameters added to every request, like {"sap-language": "EN"}), headers and secret_headers (extra headers, the second one reads the values from secrets), csrf (auto: the X-CSRF-Token is fetched when a write is refused with X-CSRF-Token: Required; true: fetched before the first write; false: never), allow_plain (false: credentials over http are refused unless the host is local), ca_file (a PEM file of a private CA), timeout_ms (30000), max_bytes (64 MB, the largest answer) - String - required
    method:   The method - String - required
    path:   The path - String - required
    body_json:   The JSON body - String - required
admin
odata request "{\"url\": \"https://services.odata.org/V4/(S(mentdbv4examples))/TripPinServiceRW\"}" "POST" "Airlines" "{\"AirlineCode\": \"RE\", \"Name\": \"Air Austral\"}"
mentdb
{"@odata.context":"http://services.odata.org/V4/(S(mentdbv4examples))/TripPinServiceRW/$metadata#Airlines/$entity","@odata.id":"http://services.odata.org/V4/(S(mentdbv4examples))/TripPinServiceRW/Airlines('RE')","@odata.editLink":"http://services.odata.org/V4/(S(mentdbv4examples))/TripPinServiceRW/Airlines('RE')","AirlineCode":"RE","Name":"Air Austral"}