(POST) Create a new Object
To create a new Object send a POST request to the Data Service API:
Note how we have included our
collection name in the URL - all data objects MUST belong to a collection. Collections cannot be created by users, but must be created by a Jamroom master admin (i.e. you) ahead of time in the Proxima Data -> Data Collections section in your Jamroom APC. Think of a collection like a database "table" - it allows you to group objects by common criteria. In our example we show the name of the collection as "collection", but it will be named whatever you want it to be.
A collection can be set with specific permissions when it is created:
-
Owner read and write - this is the default - when a user creates a new Object in the collection, only the User that created the object can READ, UPDATE or DELETE it - basically it is a "private" entry in the DB.
-
Global Read Only - when a new Object is created, only the Owner will be able to UPDATE or DELETE it, but everyone else will be able to READ it.
-
Global Read and Write - this basically "opens" the permissions - anyone can create, update or delete any object (so be careful!).
If your POST request is successful, you will receive a
201 Created response that looks something like this:
{
code: 201,
text: 'Created',
note: 'item created',
data:
{
_id: 196,
location: 'http://yoursite.com/api/data/collection/196'
}
}
Just like when we created a new user account, you will get a unique "_id" in the response and "location" that you can then use at a later point to access or update the data stored in the Object.