Show/Hide Toolbars

TMS XData Documentation

Navigation: URL Conventions > Resource Path

Addressing Single Entity

Scroll Prev Top Next More

A single entity in an entity set can be addressed by passing the entity key between parenthesis after the entity set name. The following example represents a specified Customer object with id (key) equals to 3.

 

http://server:2001/tms/xdata/Customer(3)

 

The literals in key predicates can also represent other types than integer, such as strings or guids. The following example retrieves the employee with id equals to "XYZ".

 

http://server:2001/tms/xdata/Employee('XYZ')

 

If you have entity types with compound keys (not recommended, actually), you can access it by naming each value and separate them using commas. The order is not significant. The next example represents the URL address of a Person entity identified by a compounded key made up of two properties, LastName and FirstName, which values are "Doe" and "John", respectively.

 

http://server:2001/tms/xdata/Person('Doe','John')

http://server:2001/tms/xdata/Person(LastName='Doe',FirstName='John')

 

XData uses JSON Format to represent the entity resources available in such URL addresses. To know more about the format specification, please refer to the topic that explains JSON format representation of a single entity.

 

Key as segments

 

If property TXDataServerModule.EnableKeyAsSegment is True (same property is available in TXDataServer), single entities can also be addresses by the name of the entity followed by a slash and the id, as the following examples:

 

http://server:2001/tms/xdata/Customer/3

http://server:2001/tms/xdata/Employee/XYZ

 

Compound keys can be passed one after order, each also separated by slashes:

 

http://server:2001/tms/xdata/Person/Doe/John