Creating Data

Create new custom mesh data into specified mesh name.

// Mesh is derived from class name
public class Person: MeshData
{
  public string FirstName { get; set; }
  public string LastName { get; set; }
}

var client = MeshyClient.Initialize(accountName, publicKey);
var connection = await client.LoginAnonymouslyAsync(username);

var person = await connection.Meshes.CreateAsync(new Person(){
  FirstName="Bob",
  LastName="Bobberson"
});

Parameters

accountName : string, required
Indicates which account you are connecting to.
publicKey : string, required
Public identifier of connecting service.
username : string, required
Unique identifier for user or device.
mesh : string, default: class name
Identifies name of mesh collection. e.g. person.
var client = MeshyClient.initialize(accountName, publicKey);

var anonymousUser = await client.registerAnonymousUser();

var meshyConnection = await client.loginAnonymously(anonymousUser.username);

var createdMesh = await meshyConnection.meshes.create(meshName,
                                                {
                                                   firstName:"Bob",
                                                   lastName:"Bobberson"
                                                });

Parameters

accountName : string, required
Indicates which account you are connecting to.
publicKey : string, required
Public identifier of connecting service.
username : string, required
Unique identifier for user or device.
meshName : string, required
Identifies name of mesh collection. e.g. person.
POST https://api.meshydb.com/{accountName}/meshes/{mesh} HTTP/1.1
Authentication: Bearer {access_token}
Content-Type: application/json

   {
      "firstName": "Bob",
      "lastName": "Bobberson"
   }

Parameters

accountName : string, required
Indicates which account you are connecting to.
access_token : string, required
Token identifying authorization with MeshyDB requested during Generating Token.
mesh : string, required
Identifies name of mesh collection. e.g. person.

Responses

201 : Created
  • Result of newly created mesh data.

Example Result

{
   "_id":"5c78cc81dd870827a8e7b6c4",
   "firstName": "Bob",
   "lastName": "Bobberson"
}
400 : Bad request
  • Mesh name is invalid and must be alpha characters only.
  • Mesh property cannot begin with ‘$’ or contain ‘.’.
401 : Unauthorized
  • User is not authorized to make call.
403 : Forbidden
  • User has insufficent permission to create meshes or specific mesh.
429 : Too many request
  • You have either hit your API or Database limit. Please review your account.