{"_id":"56c41cee2d97560d00e23cff","__v":4,"category":{"_id":"56c4183bbb64720d00552b88","__v":6,"pages":["56c41cc5521f350d00d34901","56c41ccf54b6030d00ec29aa","56c41cdd54b6030d00ec29ac","56c41ce7106c12170020dba4","56c41cee2d97560d00e23cff","56c41cf72d97560d00e23d01"],"project":"56bc8e679afb8b0d00d62dcf","version":"56bc8e689afb8b0d00d62dd2","sync":{"url":"","isSync":false},"reference":true,"createdAt":"2016-02-17T06:50:35.303Z","from_sync":false,"order":4,"slug":"metadata","title":"Metadata"},"githubsync":"","version":{"_id":"56bc8e689afb8b0d00d62dd2","project":"56bc8e679afb8b0d00d62dcf","__v":18,"createdAt":"2016-02-11T13:36:40.146Z","releaseDate":"2016-02-11T13:36:40.146Z","categories":["56bc8e689afb8b0d00d62dd3","56c3c837bc41330d009f25ed","56c3c83e521f350d00d348eb","56c3c8452d97560d00e23cd8","56c3c85234df460d00c2beb8","56c4180d70187b17005f43b4","56c418162d97560d00e23cf6","56c4181cc4796b0d007ef039","56c4182370187b17005f43b5","56c418292e75e01700986052","56c4183328bd680d005e7ac6","56c4183bbb64720d00552b88","56c418414040602b0064cea0","56c4184754b6030d00ec29a1","56c4184c28bd680d005e7ac7","56c4185370187b17005f43b6","56c4185b6063071700500cfc","582a98b6f8c0a0190053d7a5"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"1.0.0","version":"1.0"},"parentDoc":null,"user":"56b98db7bb36440d0001f492","project":"56bc8e679afb8b0d00d62dcf","updates":[],"next":{"pages":[],"description":""},"createdAt":"2016-02-17T07:10:38.205Z","link_external":false,"link_url":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":4,"body":"[block:api-header]\n{\n  \"type\": \"get\",\n  \"title\": \"/metadata/{id}\"\n}\n[/block]\nReturns a set of metadata keys matching the given criteria. \n\n**Note:** There are two mutually-exclusive parameters offered for Metadata searching:\n* `key` and `keyPrefix`\n* `created` and `lastModified`\n\n`key` matches by name exactly while `keyPrefix` utilizes substring matching.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"var options = {\\n\\tvisibility: \\\"App\\\",\\n\\tkey: \\\"MyKey\\\",\\n\\tkeyPrefix: \\\"data_\\\",\\n\\tlocationRange: \\\"47.1, -122.3, 10000\\\",\\n\\tcreated: \\\"2014/6/01-2014/12/31\\\",\\n\\tlastModified: \\\"2014/6/01-2014/12/31\\\",\\n\\tvaluePath: \\\"some.path\\\",\\n\\tvalue: \\\"Some metadata\\\",\\n\\tpagingToken: \\\"10;20\\\",\\n\\tsortOrder: \\\"-{sortingParameter}\\\",\\n\\townerID: \\\"bvc.nqgbvzkcrDlr\\\"\\n};\\n\\nBuddy.get('/metadata/my_id',\\n\\t\\toptions,\\n\\t\\tfunction(err, result) {\\n\\t\\t\\t \\n\\t\\t\\tif (result.success) {\\n\\t\\t\\t\\t// Do something with the result!\\n\\t\\t\\t} else { \\n\\t\\t\\t\\t// Otherwise log the error\\n\\t\\t\\t\\tconsole.log(err); \\n\\t\\t\\t} \\n\\t\\t}\\n\\t);\",\n      \"language\": \"javascript\"\n    },\n    {\n      \"code\": \"NSDictionary *params = :::at:::{\\n\\t\\t\\[email protected]\\\"visibility\\\": @\\\"App\\\",\\n\\t\\t\\[email protected]\\\"key\\\": @\\\"MyKey\\\",\\n\\t\\t\\[email protected]\\\"keyPrefix\\\": @\\\"data_\\\",\\n\\t\\t\\[email protected]\\\"locationRange\\\": BPCoordinateRangeMake(47.1, -121.292, 2500),\\n\\t\\t\\[email protected]\\\"created\\\": @\\\"2014/6/01-2014/12/31\\\",\\n\\t\\t\\[email protected]\\\"lastModified\\\": @\\\"2014/6/01-2014/12/31\\\",\\n\\t\\t\\[email protected]\\\"valuePath\\\": @\\\"some.path\\\",\\n\\t\\t\\[email protected]\\\"value\\\": @\\\"Some value\\\",\\n\\t\\t\\[email protected]\\\"pagingToken\\\": @\\\"10;20\\\",\\n\\t\\t\\[email protected]\\\"sortOrder\\\": @\\\"-{sortingParameter}\\\",\\n\\t\\t\\[email protected]\\\"ownerID\\\": @\\\"bvc.nqgbvzkcrDlr\\\"\\n\\t\\t};\\n\\n[Buddy GET:@\\\"/metadata/my_id\\\" parameters:params class:[BPMetadataItem class] callback:^(id obj, NSError *error) {\\n\\t// Your callback code here\\n}];\",\n      \"language\": \"objectivec\",\n      \"name\": \"iOS\"\n    },\n    {\n      \"code\": \"Map<String, Object> parameters = new HashMap<String, Object>();\\nparameters.put(\\\"visibility\\\", \\\"App\\\");\\nparameters.put(\\\"key\\\", \\\"MyKey\\\");\\nparameters.put(\\\"keyPrefix\\\", \\\"data_\\\");\\nparameters.put(\\\"locationRange\\\", myLocationRange);\\nparameters.put(\\\"created\\\", \\\"2014/6/01-2014/12/31\\\");\\nparameters.put(\\\"lastModified\\\", \\\"2014/6/01-2014/12/31\\\");\\nparameters.put(\\\"valuePath\\\", \\\"some.path\\\");\\nparameters.put(\\\"value\\\", \\\"Some metadata value\\\");\\nparameters.put(\\\"pagingToken\\\", \\\"10;20\\\");\\nparameters.put(\\\"sortOrder\\\", \\\"-{sortingParameter}\\\");\\nparameters.put(\\\"ownerID\\\", \\\"bvc.nqgbvzkcrDlr\\\");\\n\\nBuddy.get(\\\"/metadata/my_id\\\", parameters, new BuddyCallback<MetadataItem>(MetadataItem.class) {\\n\\[email protected]\\n\\tpublic void completed(BuddyResult<MetadataItem> result) {\\n\\t\\t// Your callback code here\\n\\t}\\n});\",\n      \"language\": \"java\",\n      \"name\": \"Android\"\n    },\n    {\n      \"code\": \"var options = new {\\n\\t\\t\\tvisibility = \\\"App\\\",\\n\\t\\t\\tkey = \\\"MyKey\\\",\\n\\t\\t\\tkeyPrefix = \\\"data_\\\",\\n\\t\\t\\tlocationRange = new BuddyGeoLocationRange(47.1, -122.3, 5000),\\n\\t\\t\\tcreated = \\\"2014/6/01-2014/12/31\\\",\\n\\t\\t\\tlastModified = \\\"2014/6/01-2014/12/31\\\",\\n\\t\\t\\tvaluePath = \\\"some.path\\\",\\n\\t\\t\\tvalue = \\\"Some value\\\",\\n\\t\\t\\tpagingToken = \\\"10;20\\\",\\n\\t\\t\\tsortOrder = \\\"-{sortingParameter}\\\",\\n\\t\\t\\townerID = \\\"bvc.nqgbvzkcrDlr\\\"\\n\\t\\t};\\n\\nvar result = await Buddy.GetAsync<MetadataItem>(\\\"/metadata/my_id\\\", options);\",\n      \"language\": \"csharp\",\n      \"name\": \".NET\"\n    }\n  ],\n  \"sidebar\": true\n}\n[/block]\n###Path Parameters\n\nThese parameters should be specified as part of the HTTP path.\n[block:parameters]\n{\n  \"data\": {\n    \"0-0\": \"id\",\n    \"0-1\": \"The ID of the object that the metadata is associated with.\",\n    \"0-2\": \"buddyId\",\n    \"0-3\": \"Required\"\n  },\n  \"cols\": 4,\n  \"rows\": 1\n}\n[/block]\n###Body Parameters\n\nThese parameters should be specified as part of the request body.\n[block:parameters]\n{\n  \"data\": {\n    \"0-0\": \"visibility\",\n    \"1-0\": \"key\",\n    \"2-0\": \"keyPrefix\",\n    \"3-0\": \"locationRange\",\n    \"4-0\": \"created\",\n    \"5-0\": \"lastModified\",\n    \"6-0\": \"valuePath\",\n    \"7-0\": \"value\",\n    \"8-0\": \"pagingToken\",\n    \"9-0\": \"sortOrder\",\n    \"10-0\": \"ownerID\",\n    \"0-1\": \"Specifies the visibility of this item. Values are User, which means only the user that created the value can access or modify it, or App, which allows any app code to view the value.\",\n    \"1-1\": \"The key associated with the metadata to search on.\",\n    \"2-1\": \"The prefix of the key name to search on. If there are two keys with names data_123 and data_452 then keyPrefix: 'data_' would retrieve both values.\",\n    \"3-1\": \"Specifies the location and range to search within specified as {latitude}, {longitude}, {range in meters}, for example 47.1,-122.3,10000. Note: there is a maximum searchable radius of 20,000 meters.\",\n    \"4-1\": \"Searches for the created value of an object by date range. Valid date formats include UTC timestamps specified as Unix ticks (milliseconds since Jan 1, 1970) such as \\\"136512000000-1398816000000\\\" and common date formats such as \\\"2012/1/27-2014/5/6\\\".\",\n    \"5-1\": \"Searches for the lastModified value of an object by date range. Valid date formats include UTC timestamps specified as Unix ticks (milliseconds since Jan 1, 1970) such as \\\"136512000000-1398816000000\\\" and common date formats such as \\\"2012/1/27-2014/5/6\\\".\",\n    \"6-1\": \"The path of the value within a complex object. Works in conjunction with value\",\n    \"7-1\": \"The value to search for at the given valuePath. Works in conjunction with valuePath\",\n    \"8-1\": \"Specifies the current page of results to obtain in a multi-page result set. The token can be obtained from a search result set by looking at the currentToken, nextToken, and previousToken result values which, when used in a subsequent search, will return the current, next, and previous page of results. Paging can be specified manually in the format \\\"{limit};{skip}\\\", where \\\"10;20\\\" would dictate a \\\"page limit of 10, skipping the first 20 results.\\\"\",\n    \"9-1\": \"Specifies the order in which a collection of results should be returned. To use this parameter, identify the parameter to sort on and prepend it with \\\"+\\\" to sort the results on field in ascending order or \\\"-\\\" for descending order (e.g. specifying \\\"+firstName\\\" will sort the results on the first name of each record, in ascending order).\",\n    \"10-1\": \"The Buddy ID of the user who owns (created) this object.\",\n    \"10-2\": \"buddyId\",\n    \"0-2\": \"string\",\n    \"1-2\": \"string\",\n    \"2-2\": \"string\",\n    \"3-2\": \"string\",\n    \"4-2\": \"string\",\n    \"5-2\": \"string\",\n    \"6-2\": \"string\",\n    \"7-2\": \"string\",\n    \"8-2\": \"string\",\n    \"9-2\": \"string\",\n    \"0-3\": \"Optional\",\n    \"1-3\": \"Optional\",\n    \"2-3\": \"Optional\",\n    \"3-3\": \"Optional\",\n    \"4-3\": \"Optional\",\n    \"5-3\": \"Optional\",\n    \"6-3\": \"Optional\",\n    \"7-3\": \"Optional\",\n    \"8-3\": \"Optional\",\n    \"9-3\": \"Optional\",\n    \"10-3\": \"Optional\"\n  },\n  \"cols\": 4,\n  \"rows\": 11\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"\\\"status\\\": 200,\\n  \\\"result\\\": {\\n    \\\"currentToken\\\": \\\"W3t9LCIxMDA7MCIsbnVsbF01\\\",\\n    \\\"pageResults\\\": [\\n      {\\n        \\\"key\\\": \\\"key1\\\",\\n        \\\"value\\\": \\\"Value 1\\\",\\n        \\\"created\\\": \\\"/Date(1405363914000)/\\\",\\n        \\\"lastModified\\\": \\\"/Date(1405363914498)/\\\"\\n      },\\n      {\\n        \\\"key\\\": \\\"key2\\\",\\n        \\\"value\\\": 5,\\n        \\\"created\\\": \\\"/Date(1405363914000)/\\\",\\n        \\\"lastModified\\\": \\\"/Date(1405363914498)/\\\"\\n      },\\n      {\\n        \\\"key\\\": \\\"some_data\\\",\\n        \\\"value\\\": \\\"this is a value\\\",\\n        \\\"created\\\": \\\"/Date(1405363106000)/\\\",\\n        \\\"lastModified\\\": \\\"/Date(1405363106047)/\\\"\\n      }\\n    ]\\n  },\\n  \\\"request_id\\\": \\\"53c43716b32fad05c0bcafc1\\\",\\n  \\\"success\\\": true\\n} \",\n      \"language\": \"json\",\n      \"name\": \"Response\"\n    }\n  ],\n  \"sidebar\": true\n}\n[/block]","excerpt":"","slug":"search-metadata","type":"basic","title":"Search Metadata"}
[block:api-header] { "type": "get", "title": "/metadata/{id}" } [/block] Returns a set of metadata keys matching the given criteria. **Note:** There are two mutually-exclusive parameters offered for Metadata searching: * `key` and `keyPrefix` * `created` and `lastModified` `key` matches by name exactly while `keyPrefix` utilizes substring matching. [block:code] { "codes": [ { "code": "var options = {\n\tvisibility: \"App\",\n\tkey: \"MyKey\",\n\tkeyPrefix: \"data_\",\n\tlocationRange: \"47.1, -122.3, 10000\",\n\tcreated: \"2014/6/01-2014/12/31\",\n\tlastModified: \"2014/6/01-2014/12/31\",\n\tvaluePath: \"some.path\",\n\tvalue: \"Some metadata\",\n\tpagingToken: \"10;20\",\n\tsortOrder: \"-{sortingParameter}\",\n\townerID: \"bvc.nqgbvzkcrDlr\"\n};\n\nBuddy.get('/metadata/my_id',\n\t\toptions,\n\t\tfunction(err, result) {\n\t\t\t \n\t\t\tif (result.success) {\n\t\t\t\t// Do something with the result!\n\t\t\t} else { \n\t\t\t\t// Otherwise log the error\n\t\t\t\tconsole.log(err); \n\t\t\t} \n\t\t}\n\t);", "language": "javascript" }, { "code": "NSDictionary *params = @{\n\t\t\[email protected]\"visibility\": @\"App\",\n\t\t\[email protected]\"key\": @\"MyKey\",\n\t\t\[email protected]\"keyPrefix\": @\"data_\",\n\t\t\[email protected]\"locationRange\": BPCoordinateRangeMake(47.1, -121.292, 2500),\n\t\t\[email protected]\"created\": @\"2014/6/01-2014/12/31\",\n\t\t\[email protected]\"lastModified\": @\"2014/6/01-2014/12/31\",\n\t\t\[email protected]\"valuePath\": @\"some.path\",\n\t\t\[email protected]\"value\": @\"Some value\",\n\t\t\[email protected]\"pagingToken\": @\"10;20\",\n\t\t\[email protected]\"sortOrder\": @\"-{sortingParameter}\",\n\t\t\[email protected]\"ownerID\": @\"bvc.nqgbvzkcrDlr\"\n\t\t};\n\n[Buddy GET:@\"/metadata/my_id\" parameters:params class:[BPMetadataItem class] callback:^(id obj, NSError *error) {\n\t// Your callback code here\n}];", "language": "objectivec", "name": "iOS" }, { "code": "Map<String, Object> parameters = new HashMap<String, Object>();\nparameters.put(\"visibility\", \"App\");\nparameters.put(\"key\", \"MyKey\");\nparameters.put(\"keyPrefix\", \"data_\");\nparameters.put(\"locationRange\", myLocationRange);\nparameters.put(\"created\", \"2014/6/01-2014/12/31\");\nparameters.put(\"lastModified\", \"2014/6/01-2014/12/31\");\nparameters.put(\"valuePath\", \"some.path\");\nparameters.put(\"value\", \"Some metadata value\");\nparameters.put(\"pagingToken\", \"10;20\");\nparameters.put(\"sortOrder\", \"-{sortingParameter}\");\nparameters.put(\"ownerID\", \"bvc.nqgbvzkcrDlr\");\n\nBuddy.get(\"/metadata/my_id\", parameters, new BuddyCallback<MetadataItem>(MetadataItem.class) {\n\[email protected]\n\tpublic void completed(BuddyResult<MetadataItem> result) {\n\t\t// Your callback code here\n\t}\n});", "language": "java", "name": "Android" }, { "code": "var options = new {\n\t\t\tvisibility = \"App\",\n\t\t\tkey = \"MyKey\",\n\t\t\tkeyPrefix = \"data_\",\n\t\t\tlocationRange = new BuddyGeoLocationRange(47.1, -122.3, 5000),\n\t\t\tcreated = \"2014/6/01-2014/12/31\",\n\t\t\tlastModified = \"2014/6/01-2014/12/31\",\n\t\t\tvaluePath = \"some.path\",\n\t\t\tvalue = \"Some value\",\n\t\t\tpagingToken = \"10;20\",\n\t\t\tsortOrder = \"-{sortingParameter}\",\n\t\t\townerID = \"bvc.nqgbvzkcrDlr\"\n\t\t};\n\nvar result = await Buddy.GetAsync<MetadataItem>(\"/metadata/my_id\", options);", "language": "csharp", "name": ".NET" } ], "sidebar": true } [/block] ###Path Parameters These parameters should be specified as part of the HTTP path. [block:parameters] { "data": { "0-0": "id", "0-1": "The ID of the object that the metadata is associated with.", "0-2": "buddyId", "0-3": "Required" }, "cols": 4, "rows": 1 } [/block] ###Body Parameters These parameters should be specified as part of the request body. [block:parameters] { "data": { "0-0": "visibility", "1-0": "key", "2-0": "keyPrefix", "3-0": "locationRange", "4-0": "created", "5-0": "lastModified", "6-0": "valuePath", "7-0": "value", "8-0": "pagingToken", "9-0": "sortOrder", "10-0": "ownerID", "0-1": "Specifies the visibility of this item. Values are User, which means only the user that created the value can access or modify it, or App, which allows any app code to view the value.", "1-1": "The key associated with the metadata to search on.", "2-1": "The prefix of the key name to search on. If there are two keys with names data_123 and data_452 then keyPrefix: 'data_' would retrieve both values.", "3-1": "Specifies the location and range to search within specified as {latitude}, {longitude}, {range in meters}, for example 47.1,-122.3,10000. Note: there is a maximum searchable radius of 20,000 meters.", "4-1": "Searches for the created value of an object by date range. Valid date formats include UTC timestamps specified as Unix ticks (milliseconds since Jan 1, 1970) such as \"136512000000-1398816000000\" and common date formats such as \"2012/1/27-2014/5/6\".", "5-1": "Searches for the lastModified value of an object by date range. Valid date formats include UTC timestamps specified as Unix ticks (milliseconds since Jan 1, 1970) such as \"136512000000-1398816000000\" and common date formats such as \"2012/1/27-2014/5/6\".", "6-1": "The path of the value within a complex object. Works in conjunction with value", "7-1": "The value to search for at the given valuePath. Works in conjunction with valuePath", "8-1": "Specifies the current page of results to obtain in a multi-page result set. The token can be obtained from a search result set by looking at the currentToken, nextToken, and previousToken result values which, when used in a subsequent search, will return the current, next, and previous page of results. Paging can be specified manually in the format \"{limit};{skip}\", where \"10;20\" would dictate a \"page limit of 10, skipping the first 20 results.\"", "9-1": "Specifies the order in which a collection of results should be returned. To use this parameter, identify the parameter to sort on and prepend it with \"+\" to sort the results on field in ascending order or \"-\" for descending order (e.g. specifying \"+firstName\" will sort the results on the first name of each record, in ascending order).", "10-1": "The Buddy ID of the user who owns (created) this object.", "10-2": "buddyId", "0-2": "string", "1-2": "string", "2-2": "string", "3-2": "string", "4-2": "string", "5-2": "string", "6-2": "string", "7-2": "string", "8-2": "string", "9-2": "string", "0-3": "Optional", "1-3": "Optional", "2-3": "Optional", "3-3": "Optional", "4-3": "Optional", "5-3": "Optional", "6-3": "Optional", "7-3": "Optional", "8-3": "Optional", "9-3": "Optional", "10-3": "Optional" }, "cols": 4, "rows": 11 } [/block] [block:code] { "codes": [ { "code": "\"status\": 200,\n \"result\": {\n \"currentToken\": \"W3t9LCIxMDA7MCIsbnVsbF01\",\n \"pageResults\": [\n {\n \"key\": \"key1\",\n \"value\": \"Value 1\",\n \"created\": \"/Date(1405363914000)/\",\n \"lastModified\": \"/Date(1405363914498)/\"\n },\n {\n \"key\": \"key2\",\n \"value\": 5,\n \"created\": \"/Date(1405363914000)/\",\n \"lastModified\": \"/Date(1405363914498)/\"\n },\n {\n \"key\": \"some_data\",\n \"value\": \"this is a value\",\n \"created\": \"/Date(1405363106000)/\",\n \"lastModified\": \"/Date(1405363106047)/\"\n }\n ]\n },\n \"request_id\": \"53c43716b32fad05c0bcafc1\",\n \"success\": true\n} ", "language": "json", "name": "Response" } ], "sidebar": true } [/block]