SDK
SDK C# v1.x
1

You are currently looking at the documentation of a previous version of Kuzzle. We strongly recommend that you use the latest version. You can also use the version selector in the top menu.

GetAsync #

Gets a document.

Arguments #

Copied to clipboard!
public async Task<JObject> GetAsync(
  string index, 
  string collection, 
  string id);


Argument Type Description
index
string
Index name
collection
string
Collection name
id
string
Document ID

Return #

A JObject representing the document content.

Property Type Description
_id
string
Document ID
_source
JObject
Document content

Exceptions #

Throws a KuzzleException if there is an error. See how to handle errors.

Usage #

Copied to clipboard!
try {
  await kuzzle.Document.CreateAsync(
    "nyc-open-data",
    "yellow-taxi",
    JObject.Parse(@"{""capacity"": 4}"),
    id: "some-id");
  JObject response =
    await kuzzle.Document.GetAsync("nyc-open-data", "yellow-taxi", "some-id");
  Console.WriteLine(response.ToString());
  /*
  {
    "_index":"nyc-open-data",
    "_type":"yellow-taxi",
    "_id":"some-id",
    "_version":1,
    "found":true,
    "_source":{
      "capacity":4,
      "_kuzzle_info":{
        "author":"-1",
        "createdAt":1538402859880,
        "updatedAt":null,
        "updater":null,
        "active":true,
        "deletedAt":null
      }
    }
  }
  */
  Console.WriteLine("Success");
} catch (KuzzleException e) {
  Console.Error.WriteLine(e);
}