The environment
As part of an integration project, I need a PHP website to be able to both read from and write to Microsoft Dynamics NAV 2016's Odata services.
Microsoft Dynamics NAV 2016 uses the Odata v3 standard.
The context
Now, let's take my customer service as an example.
Fetching a collection of entities
Fetching an overview of my collection of customer entities works fine, using a link with the following format :
https://<Server>:<WebServicePort>/<ServerInstance>/OData/Company(\'<CompanyName>\')/customer
Fetching a single entity
Fetching a single customer entity based on id works fine, using a link with the following format :
https://<Server>:<WebServicePort>/<ServerInstance>/OData/Company(\'<CompanyName>\')/customer(\'<Id>\')
Fetching the global metadata
Getting an overview of the $metadata for all of my services works fine (although it's lacking Json support), using a link with the following format :
https://<Server>:<WebServicePort>/<ServerInstance>/OData/$metadata
Fetching collection-specific metadata
Now, based on both the Odata v3 specs and the value of the odata.metadata property of my customer overview service, I would expect to be able to get an overview of the $metadata of the customer entity, using a link with the following format :
https://<Server>:<WebServicePort>/<ServerInstance>/OData/$metadata#customer
This doesn't work as expected. See sub-section The issue below.
Fetching entity-specific metadata
Similarly, based on both the Odata v3 specs and the value of the odata.metadata property of my dataset when retrieving a single customer, I would expect to be able to get an overview of the $metadata of a single field of the customer entity, using a link with this format :
https://<Server>:<WebServicePort>/<ServerInstance>/OData/$metadata#customer/@<FieldName>
This doesn't work as expected. See sub-section The issue below.
The issue
For some reason, everything following $metadata appears to be ignored. This means that the last three URLs give me the exact same output, which is not what I expected.
The actual question(s)
- Is it possible to fetch the metadata of just one collection or entity, as I'm trying in sub-sections
Fetching collection-specific metadataandFetching entity-specific metadataof myThe contextsection hereabove? - If yes, what I doing wrong here? What am I missing?