Examples of Using REST Interface with the SQL Data Services
SOAP and REST interfaces may be used when developing applications using the Microsoft® SQL Data Services (SDS). These topics provide examples that use the REST interface.
If using Visual Studio to test the C# samples in these topics, the steps to create a working sample are:
Create a Visual Studio console application.
Enter the code that is provided in the specific topic. You will need to update the code as follows:
Provide your credentials (user name and password).
In some samples, you may need to update the code and provide appropriate container/entity ids for the objects that you are dealing with. For example, if you are updating an entity, you will need to provide an identifier for the entity that you want to update and the identifier for the container in which the entity resides.
- Provide your credentials (user name and password).
You may find the following queries useful in locating your authority, containers, and entities. In all the following examples,
data.database.windows.net refers to the service, and
v1 refers to the service version.
|NOTE: SQL Data Services support content type, |
Understanding URI Space
When writing these samples, you will deal with various URIs that are classified as authority, container, and entity URIs.
An authority URI is used to retrieve information about a particular authority instance. The authority URI is also used to query the containers.
A container URI is used to retrieve information about a particular container instance. It is also used to query the entities.
An entity URI can be used to retrieve a particular entity.
These URIs set the scope for the query that optionally follows.
To locate all containers in an authority, enter the authority URI followed by an empty query.
To find a specific container, you write a container URI.
To find all the entities in a specific container, enter the container URI, followed by an empty query.
To find a set of entities in a container, enter the container URI, followed by a query for the entity.
https://<authority-id>.data.database.windows.net/v1/<container-id>?q='from e in entities where e.Kind=="MyKind" select e'