{"_id":"579f69887e1804200071f1dd","__v":0,"project":"54774d9af3736008009e9e0e","category":{"_id":"56c50628bdcde80d00498639","__v":1,"project":"54774d9af3736008009e9e0e","pages":["56c5062fbdcde80d0049869a","56c5062fbdcde80d0049869b","56c5062fbdcde80d0049869c","56c5062fbdcde80d0049869d","56c5062fbdcde80d0049869e","56c5062fbdcde80d0049869f"],"version":"56c50626bdcde80d00498635","sync":{"url":"","isSync":false},"reference":true,"createdAt":"2015-03-17T14:15:35.496Z","from_sync":false,"order":3,"slug":"data-objects","title":"Data Objects"},"user":"5718db25f8f7de1900683f8c","parentDoc":null,"githubsync":"","version":{"_id":"56c50626bdcde80d00498635","project":"54774d9af3736008009e9e0e","__v":10,"createdAt":"2016-02-17T23:45:42.869Z","releaseDate":"2016-02-17T23:45:42.869Z","categories":["56c50628bdcde80d00498636","56c50628bdcde80d00498637","56c50628bdcde80d00498638","56c50628bdcde80d00498639","56c50628bdcde80d0049863a","56c50628bdcde80d0049863b","56c50628bdcde80d0049863c","56c50628bdcde80d0049863d","56c50628bdcde80d0049863e","56c50628bdcde80d0049863f","56c50628bdcde80d00498640","56c50628bdcde80d00498641","56c50628bdcde80d00498642","56c50628bdcde80d00498643","56c50628bdcde80d00498644","56c50628bdcde80d00498645","56c50628bdcde80d00498646","56c50628bdcde80d00498647","56c506a018f0c90d002808de","56c6b0baf795cf0d003ec13e","56fe58eb5a08190e00085149","571764513cf2960e0009a635","571fc008ffbc6a2000b25bb5","5739ca371f4b740e00b06e09","577522f197a3830e004bcc1b","57753d5ffecd260e00d86ce6","57adb71efaa7a10e004495b6"],"is_deprecated":true,"is_hidden":false,"is_beta":false,"is_stable":false,"codename":"API v1.1","version_clean":"0.1.1","version":"0.1.1"},"updates":[],"next":{"pages":[],"description":""},"createdAt":"2016-08-01T15:23:52.318Z","link_external":false,"link_url":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[{"status":200,"name":"","code":"{\n  \"prev\": null,\n  \"objects\": [\n    {\n      \"channel_room\": null,\n      \"group\": null,\n      \"name\": \"Geralt\",\n      \"links\": {\n        \"self\": \"/v1.1/instances/rivia/classes/witchers/objects/11/\"\n      },\n      \"city\": \"Rivia\",\n      \"group_permissions\": \"none\",\n      \"created_at\": \"2015-05-20T19:43:13.480389Z\",\n      \"owner_permissions\": \"none\",\n      \"updated_at\": \"2015-05-20T19:43:13.480436Z\",\n      \"other_permissions\": \"none\",\n      \"owner\": null,\n      \"id\": 11,\n      \"channel\": null,\n      \"revision\": 1\n    },\n    {\n      \"channel_room\": null,\n      \"group\": null,\n      \"name\": \"Geralt\",\n      \"links\": {\n        \"self\": \"/v1.1/instances/rivia/classes/witchers/objects/12/\"\n      },\n      \"city\": \"Rivia\",\n      \"group_permissions\": \"none\",\n      \"created_at\": \"2015-05-20T19:47:08.020650Z\",\n      \"owner_permissions\": \"none\",\n      \"updated_at\": \"2015-05-20T19:47:08.020707Z\",\n      \"other_permissions\": \"none\",\n      \"owner\": null,\n      \"id\": 12,\n      \"channel\": null,\n      \"revision\": 1\n    },\n    {\n      \"channel_room\": null,\n      \"group\": null,\n      \"name\": \"Geralt\",\n      \"links\": {\n        \"self\": \"/v1.1/instances/rivia/classes/witchers/objects/13/\"\n      },\n      \"city\": \"Rivia\",\n      \"group_permissions\": \"none\",\n      \"created_at\": \"2015-05-20T19:51:19.712771Z\",\n      \"owner_permissions\": \"none\",\n      \"updated_at\": \"2015-05-27T13:37:56.875321Z\",\n      \"other_permissions\": \"none\",\n      \"owner\": null,\n      \"id\": 13,\n      \"channel\": null,\n      \"revision\": 3\n    }\n  ],\n  \"next\": null\n}","language":"json"},{"language":"json","status":400,"code":"{\n  \"detail\": \"Cannot use specified order_by field. Set required index on schema first.\"\n}\n"},{"code":"{\n  \"detail\": \"No such API Key.\"\n}","language":"json","status":403},{"code":"{\n  \"detail\": \"Class was not found.\"\n}","status":404,"language":"json"}]},"settings":"56c50c06d1b8770d00922288","examples":{"codes":[{"name":"","code":"curl -X GET -G \\\n-H \"X-API-KEY: API_KEY\" \\\n-H \"X-USER-KEY: USER_KEY\" \\\n-d query='{\"city\":{\"_eq\":\"Rivia\"}}' \\\n-d order_by=\"created_at\" \\\n-d include_count=true \\\n\"https://api.syncano.io/v1.1/instances/INSTANCE_NAME/classes/DATA_CLASS_NAME/objects/\"","language":"curl"},{"code":"import syncano \nfrom syncano.models import Object\n\nconnection = syncano.connect(api_key=\"API_KEY\", user_key=\"USER_KEY\", instance_name=\"INSTANCE_NAME\")\n\nlist_of_objects = Object.please.list(\n    class_name=\"CLASS_NAME\").filter(city=\"Rivia\").order_by(\"created_at\")\n","language":"python"},{"language":"javascript","code":"var Syncano = require('syncano');\n\nvar connection = Syncano({\n  apiKey: 'API_KEY',\n  userKey: 'USER_KEY', \n  defaults: { \n    instanceName: \"INSTANCE_NAME\", \n    className: \"CLASS_NAME\"\n  }\n });\n\nvar DataObject = connection.DataObject;\n\nDataObject\n  .please()\n  .list()\n  .then(function(res, raw) { \n      console.log(raw);\n  });"}]},"method":"get","auth":"required","params":[{"_id":"54d8b350628f540d00f3e4ae","ref":"","in":"path","required":true,"desc":"Instance name","default":"","type":"string","name":"instance_name"},{"_id":"54dc9b86ac05560d003359a9","ref":"","in":"path","required":true,"desc":"Data Class name","default":"","type":"string","name":"class_name"},{"_id":"555cfb547e271d0d00f3cb25","ref":"","in":"query","required":false,"desc":"Query used to filter","default":"","type":"mixed","name":"query"},{"_id":"555cfc897e271d0d00f3cb31","ref":"","in":"query","required":false,"desc":"Field to use when ordering data","default":"","type":"string","name":"order_by"},{"_id":"555e341b4f5e5a0d00837101","ref":"","in":"query","required":false,"desc":"Sets the number of objects returned in one call. Maximum and default value is 100","default":"100","type":"int","name":"page_size"},{"_id":"555e221f4f5e5a0d00836dfd","ref":"","in":"query","required":false,"desc":"Used in paging - pass last ID of an object you received in the previous call - it determines where to start the next page (please mind that the object which `id` we passed in the `last_pk` parameter won't be included in the response)","default":"","type":"int","name":"last_pk"},{"_id":"555e221f4f5e5a0d00836dfc","ref":"","in":"query","required":false,"desc":"Defines direction of paging. Use `0` or `1`, where `0` means you will receive next page of results, `1` means you will receive previous page of the results","default":"","type":"int","name":"direction"},{"_id":"56d9f074f0c80c1b007e174c","ref":"","in":"query","required":false,"desc":"Defines if request will return count of objects matching your query (or an estimate for more than 1000 objects)","default":"false","type":"boolean","name":"include_count"},{"_id":"570bb71ab37c6e340086433b","ref":"","in":"query","required":false,"desc":"Name of the template applied to the response","default":"","type":"string","name":"template_response"}],"url":"/instances/:instance_name/classes/:data_class_name/objects/"},"isReference":true,"order":5,"body":"[block:callout]\n{\n  \"type\": \"warning\",\n  \"title\": \"Authentication & API Keys\",\n  \"body\": \"To make this request you have to use Account key or combination of API key and User key.\\n\\nUsing Account key is potentially dangerous because it gives to end user or application administrator rights.\\nTo avoid possible security breaches it's suggested to use combination of API key and User key.\\n\\nFor further information about this topic please check Syncano Documentation:\\n [Connecting with API key](http://docs.syncano.io/docs/authentication#connecting-with-an-api-key)\\n[User key usage](http://docs.syncano.io/docs/user-management#user-authentication)\"\n}\n[/block]\nGet a list of Data Objects associated with a given Data Class.\n\n### Filtering\n\nWhen you download object from Syncano, in most cases you will not need to download everything. Use our filtering feature to download only the data that matches specified criteria.\n[block:callout]\n{\n  \"type\": \"info\",\n  \"body\": \"If you wanted to download objects that have the `city` parameter equal to `Rivia`, you could pass the following query: `{\\\"city\\\":{\\\"_eq\\\":\\\"Rivia\\\"}}` (just like in the example above)\",\n  \"title\": \"Example\"\n}\n[/block]\n### Ordering\nYou can also apply a custom order of returned items. By default objects are ordered based on the `id` field. \nTo apply custom ordering, pass the name of the field you would like to order on, e.g. `city`, `created_at`. You can use any field that has an ordering index added to it.\n\nBy default the order is ascending. To reverse it, just add a minus sign (`-`) in front of the passed property. For example:\n* `order=city` - sort by city in an ascending order\n* `order=-city` -sort by city in a descending order\n\nYou can read more about it in the [Filtering and Ordering Data Objects](http://docs.syncano.io/docs/data-objects-filtering-ordering) section.\n\nRemember -- if you would like to order, or filter on a chosen field -- add [indexed fields](http://docs.syncano.com/docs/classes#section-indexes) info to a Data Class Schema. \n\n### Paging\nIn case you store a lot of objects on Syncano, you will not be able to get all of them in one API call. That's when paging is useful.\n\nWhen making any kind of request to Syncano that lists some resource, you receive links to the `next` and `prev` (previous) page. \nYou can use them to paginate over the results. \n`next` and `prev` (previous) will have a `null` value if the number of returned objects doesn't exceed the page size (100 by default). \n\nImportant to remember: paging is affected by sorting! So depending on what sorting you set in the ordering (ascending or descending) paging will obey that setting.\n\nYou can read more about it in [API Overview](general-information).\n\n### Manual Paging\n[block:callout]\n{\n  \"type\": \"warning\",\n  \"body\": \"Since it can be tricky, we don't recommend manual paging.\",\n  \"title\": \"Watch out!\"\n}\n[/block]\nTo do manual paging, you should pass `last_pk` and `direction` attributes with your call:\n* `last_pk` should be equal to the last ID of an object you received in a previous call - it determines where to start the next page (please mind that the object which `id` we passed in the `last_pk` parameter won't be included in the response)\n* `direction` - determines the direction of paging - passing `1` will make you go forward (next page), passing `0` will make you go back (previous page).\n\nWe recommend you work with `query` and `order_by` attributes for paging. Stick with links returned in the response as `next` and `prev` .\nWhen you use our libraries -- you won't even have to worry about it, we use the `next` and `prev` links in there behind the scenes.\n\n### Data Objects Count\n\nYou can get the Data Objects count **estimation** when listing your objects. \nSyncano gives an exact count for Data Classes that have less than 1000 Data Objects and an estimate for Data Classes that have more than 1000 Data Objects. \nWe are not able to provide exact count without affecting the performance of the platform. Here's how you can view the Data Objects count estimation:\n\nYou can append the Data Objects count property to the response, by adding the `include_count` parameter and setting it to `true`. \nThe `object_count` property will appear in the response. See the example at the top of this page to see this feature in action.\n[block:callout]\n{\n  \"type\": \"warning\",\n  \"body\": \"If you want to test out the request right from the docs add your authentication key(s) by using green key icon below.\"\n}\n[/block]\n### Serialised version of the response\n\nWith this response type you can use `.save()` functionality. `save.()` allows for getting a Data Object,  changing its field values and saving it:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"var Syncano = require('syncano');\\n\\nvar connection = Syncano({\\n  apiKey: 'API_KEY',\\n  userKey: 'USER_KEY', \\n  defaults: { \\n    instanceName: \\\"INSTANCE_NAME\\\", \\n    className: \\\"DATA_CLASS_NAME\\\"\\n  }\\n });\\n\\nvar DataObject = connection.DataObject;\\n\\nDataObject\\n  .please()\\n  .list()\\n\\t.then(function(objects) {\\n    objects[0].name = 'Vesemir';\\n  \\tobjects[0].city = 'Kaer Morhen';\\n      return objects[0].save();\\n  })\\n  .then(function(res) { \\n      console.log(res);\\n  });\",\n      \"language\": \"javascript\"\n    }\n  ]\n}\n[/block]\nResults\nThis is an example response after changing name and city properties. Previously it was `name: 'Geralt'` and `city: 'Rivia'` (some fields were removed from the response for brevity). \n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"[ \\n  { _querySet:\\n     [...]\\n    instanceName: 'rivia',\\n    className: 'witchers',\\n    id: 11,\\n    channel_room: null,\\n    group: null,\\n    name: 'Vesemir',\\n    links: { self: '/v1.1/instances/rivia/classes/witchers/objects/11/' },\\n    city: 'Kaer Morhen',\\n    group_permissions: 'none',\\n    created_at: 2016-07-20T10:12:40.732Z,\\n    owner_permissions: 'full',\\n    updated_at: 2016-07-20T10:12:40.732Z,\\n    owner: null,\\n    other_permissions: 'none',\\n    channel: null,\\n    revision: 1 },\\n  next: [Function],\\n  hasNext: [Function],\\n  prev: [Function],\\n  hasPrev: [Function] \\n]\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]","excerpt":"List objects inside a class","slug":"data-object-list","type":"endpoint","title":"Data Object - list"}

getData Object - list

List objects inside a class

Definition

{{ api_url }}{{ page_api_url }}

Parameters

Path Params

instance_name:
required
string
Instance name
class_name:
required
string
Data Class name

Query Params

query:
mixed
Query used to filter
order_by:
string
Field to use when ordering data
page_size:
integer100
Sets the number of objects returned in one call. Maximum and default value is 100
last_pk:
integer
Used in paging - pass last ID of an object you received in the previous call - it determines where to start the next page (please mind that the object which `id` we passed in the `last_pk` parameter won't be included in the response)
direction:
integer
Defines direction of paging. Use `0` or `1`, where `0` means you will receive next page of results, `1` means you will receive previous page of the results
include_count:
booleanfalse
Defines if request will return count of objects matching your query (or an estimate for more than 1000 objects)
template_response:
string
Name of the template applied to the response

Examples


Result Format


Documentation

[block:callout] { "type": "warning", "title": "Authentication & API Keys", "body": "To make this request you have to use Account key or combination of API key and User key.\n\nUsing Account key is potentially dangerous because it gives to end user or application administrator rights.\nTo avoid possible security breaches it's suggested to use combination of API key and User key.\n\nFor further information about this topic please check Syncano Documentation:\n [Connecting with API key](http://docs.syncano.io/docs/authentication#connecting-with-an-api-key)\n[User key usage](http://docs.syncano.io/docs/user-management#user-authentication)" } [/block] Get a list of Data Objects associated with a given Data Class. ### Filtering When you download object from Syncano, in most cases you will not need to download everything. Use our filtering feature to download only the data that matches specified criteria. [block:callout] { "type": "info", "body": "If you wanted to download objects that have the `city` parameter equal to `Rivia`, you could pass the following query: `{\"city\":{\"_eq\":\"Rivia\"}}` (just like in the example above)", "title": "Example" } [/block] ### Ordering You can also apply a custom order of returned items. By default objects are ordered based on the `id` field. To apply custom ordering, pass the name of the field you would like to order on, e.g. `city`, `created_at`. You can use any field that has an ordering index added to it. By default the order is ascending. To reverse it, just add a minus sign (`-`) in front of the passed property. For example: * `order=city` - sort by city in an ascending order * `order=-city` -sort by city in a descending order You can read more about it in the [Filtering and Ordering Data Objects](http://docs.syncano.io/docs/data-objects-filtering-ordering) section. Remember -- if you would like to order, or filter on a chosen field -- add [indexed fields](http://docs.syncano.com/docs/classes#section-indexes) info to a Data Class Schema. ### Paging In case you store a lot of objects on Syncano, you will not be able to get all of them in one API call. That's when paging is useful. When making any kind of request to Syncano that lists some resource, you receive links to the `next` and `prev` (previous) page. You can use them to paginate over the results. `next` and `prev` (previous) will have a `null` value if the number of returned objects doesn't exceed the page size (100 by default). Important to remember: paging is affected by sorting! So depending on what sorting you set in the ordering (ascending or descending) paging will obey that setting. You can read more about it in [API Overview](general-information). ### Manual Paging [block:callout] { "type": "warning", "body": "Since it can be tricky, we don't recommend manual paging.", "title": "Watch out!" } [/block] To do manual paging, you should pass `last_pk` and `direction` attributes with your call: * `last_pk` should be equal to the last ID of an object you received in a previous call - it determines where to start the next page (please mind that the object which `id` we passed in the `last_pk` parameter won't be included in the response) * `direction` - determines the direction of paging - passing `1` will make you go forward (next page), passing `0` will make you go back (previous page). We recommend you work with `query` and `order_by` attributes for paging. Stick with links returned in the response as `next` and `prev` . When you use our libraries -- you won't even have to worry about it, we use the `next` and `prev` links in there behind the scenes. ### Data Objects Count You can get the Data Objects count **estimation** when listing your objects. Syncano gives an exact count for Data Classes that have less than 1000 Data Objects and an estimate for Data Classes that have more than 1000 Data Objects. We are not able to provide exact count without affecting the performance of the platform. Here's how you can view the Data Objects count estimation: You can append the Data Objects count property to the response, by adding the `include_count` parameter and setting it to `true`. The `object_count` property will appear in the response. See the example at the top of this page to see this feature in action. [block:callout] { "type": "warning", "body": "If you want to test out the request right from the docs add your authentication key(s) by using green key icon below." } [/block] ### Serialised version of the response With this response type you can use `.save()` functionality. `save.()` allows for getting a Data Object, changing its field values and saving it: [block:code] { "codes": [ { "code": "var Syncano = require('syncano');\n\nvar connection = Syncano({\n apiKey: 'API_KEY',\n userKey: 'USER_KEY', \n defaults: { \n instanceName: \"INSTANCE_NAME\", \n className: \"DATA_CLASS_NAME\"\n }\n });\n\nvar DataObject = connection.DataObject;\n\nDataObject\n .please()\n .list()\n\t.then(function(objects) {\n objects[0].name = 'Vesemir';\n \tobjects[0].city = 'Kaer Morhen';\n return objects[0].save();\n })\n .then(function(res) { \n console.log(res);\n });", "language": "javascript" } ] } [/block] Results This is an example response after changing name and city properties. Previously it was `name: 'Geralt'` and `city: 'Rivia'` (some fields were removed from the response for brevity). [block:code] { "codes": [ { "code": "[ \n { _querySet:\n [...]\n instanceName: 'rivia',\n className: 'witchers',\n id: 11,\n channel_room: null,\n group: null,\n name: 'Vesemir',\n links: { self: '/v1.1/instances/rivia/classes/witchers/objects/11/' },\n city: 'Kaer Morhen',\n group_permissions: 'none',\n created_at: 2016-07-20T10:12:40.732Z,\n owner_permissions: 'full',\n updated_at: 2016-07-20T10:12:40.732Z,\n owner: null,\n other_permissions: 'none',\n channel: null,\n revision: 1 },\n next: [Function],\n hasNext: [Function],\n prev: [Function],\n hasPrev: [Function] \n]", "language": "json" } ] } [/block]

User Information

Try It Out

get
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}