Skip to content

Object Type Creation

chernser edited this page Sep 21, 2012 · 3 revisions

Object types (or resource types) are core feature of DummyAPI. It is dead simple: you define name and DummyAPI starts handling request to URL like '/api/1/[resource type name]/[whatever]'.

Instances

When some object type is selected, table on the objects panel shows existing instances of this resource. To create one more instance - put any valid javascript object in JSON notation into field Object Data and press Create button.

Each instance has three read-only fields:

  1. app_id - your application id
  2. __objectType - name of resource type to which instance belongs
  3. _id - database engine generated id

To remove instance - select it in the table and press button with 'minus' symbol below the table

To edit instance - select it and press 'edit'

Id Field

Id field changes field name by which you can select resource instance. By default, '_id' is used. Changing id field affects all requests to/from application API and doesn't affect Backend configuration API

For example, you have resource 'User' with next structure

 { 
   "_id": "505c0f062ebc497b11000019",
   "user_name": "John",
   "id": 1
 }

and want to access it by 'user_name'. After changing id field to 'user_name' URL '/api/1/User/John' become valid for your application

Clone this wiki locally