I have an odata based api which i can query and receive data successfully using basic get commands using the api url ending with /odata.svc/workorders
and get results that look like
{
"odata.metadata": "https://myinternalserver/site/OData.svc/$metadata#WorkOrders",
"value": [
{
"WorkOrderID": 5,
"WorkOrderNumber": 11,
"WorkOrderSuffix": null,
},
I can spit the results out into a table using {{ myresults.data.value }} and looks great.
Now, If i wanted to fetch just a single particular "WorkOrderID", i tried using the URL params as i would for swagger based rest api's.
Hi Anson,
thanks for the suggestion. I had tried this suggestion yesterday as per below but always got an error which led me to believe i was going down the wrong path.
{
"odata.error": {
"code": "",
"message": {
"lang": "en-AU",
"value": "The query parameter '$metadata' begins with a system-reserved '$' character but is not recognized."
}
}
}
**If i strip out the "$" from the initial query, the response i get seems to all the available endpoints but not the actual data from ID 20668.
Sorry for the delay in reading this and thanks for getting back to me.
I had been playing with that odata link earlier but can not seem to make it work.
Ive been looking at the docs here Using The MEX API
The endpoint as mentioned is WorkOrders however i only want the data from 1 entry under the WorkOrderID field etc id 20668
Ive tried several methods
Single Entity by ID
URL/WorkOrders('20668')
Response: "value": "Bad Request - Error in query syntax."
URL/WorkOrders/('20668')WorkOrderID
Response: "value": "Bad Request - Error in query syntax."
URL/WorkOrders('20668')/WorkOrderID
Response: "value": "Bad Request - Error in query syntax."
The Best i could get was an error indicating a collection but it was still an error
URL/WorkOrders/WorkOrderID('20668')
Response: "value": "The request URI is not valid. Since the segment 'WorkOrders' refers to a collection, this must be the last segment in the request URI. All intermediate segments must refer to a single resource."
URL/WorkOrderID('20668')/WorkOrders
Response "value": "Resource not found for the segment 'WorkOrderID'."