{"_id":"56c41b0dd1f6d91700d36972","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"},"__v":3,"category":{"_id":"56c4182370187b17005f43b5","project":"56bc8e679afb8b0d00d62dcf","pages":["56c41b0dd1f6d91700d36972","56c41b4dc0c4630d004e86bc","56c41b57bb64720d00552b8f","56c41b892e75e01700986055","56c41b9548213b1700af6e2c","56c41ba72d97560d00e23cfb","56c41bb870187b17005f43bb","56c41bc6e1e4190d003429d5","56c41bd4c0c4630d004e86be","56c41be728bd680d005e7ac8","56c41c03c4796b0d007ef040","56c41c0d106c12170020dba0","56c41c1ac4796b0d007ef042","56c41c362e75e01700986057","56c41c413d30210d00ea851b","56c41c50bb64720d00552b91","56c41c5c34df460d00c2bed3","56c41c66c0c4630d004e86c0"],"version":"56bc8e689afb8b0d00d62dd2","__v":18,"sync":{"url":"","isSync":false},"reference":true,"createdAt":"2016-02-17T06:50:11.715Z","from_sync":false,"order":7,"slug":"media-and-files","title":"Media and Files"},"user":"56b98db7bb36440d0001f492","parentDoc":null,"githubsync":"","project":"56bc8e679afb8b0d00d62dcf","updates":[],"next":{"pages":[],"description":""},"createdAt":"2016-02-17T07:02:37.723Z","link_external":false,"link_url":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":0,"body":"[block:api-header]\n{\n  \"type\": \"post\",\n  \"title\": \"/pictures\"\n}\n[/block]\nUploads a new picture to Buddy.\n\nMost pictures are far below the Buddy file size restriction, however, please be considerate of upload time and data usage if the picture is coming from a mobile device.  We recommend that the application utilizes local image manipulation tools to resize the photo before sending it over the network.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"var options = {\\n\\tdata: \\\"{binary picture data}\\\",\\n\\tlocation: \\\"47.1, -121.292\\\",\\n\\tcaption: \\\"This is an awesome picture caption!\\\",\\n\\ttag: \\\"Some useful tag\\\",\\n\\twatermark: \\\"My Watermark\\\",\\n\\treadPermissions: \\\"App\\\",\\n\\twritePermissions: \\\"User\\\",\\n\\ttitle: \\\"Some Title\\\",\\n\\tuseExifData: true\\n};\\n\\nBuddy.post('/pictures',\\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      \"name\": null\n    },\n    {\n      \"code\": \"NSDictionary *params = :::at:::{\\n\\t\\t\\[email protected]\\\"data\\\": myBpFile,\\n\\t\\t\\[email protected]\\\"location\\\": BPCoordinateMake(47.1, -121.292),\\n\\t\\t\\[email protected]\\\"caption\\\": @\\\"This is an awesome picture caption!\\\",\\n\\t\\t\\[email protected]\\\"tag\\\": @\\\"Some useful tag\\\",\\n\\t\\t\\[email protected]\\\"watermark\\\": @\\\"My Watermark\\\",\\n\\t\\t\\[email protected]\\\"readPermissions\\\": @\\\"App\\\",\\n\\t\\t\\[email protected]\\\"writePermissions\\\": @\\\"User\\\",\\n\\t\\t\\[email protected]\\\"title\\\": @\\\"Some Title\\\",\\n\\t\\t\\[email protected]\\\"useExifData\\\": true\\n\\t\\t};\\n\\n[Buddy POST:@\\\"/pictures\\\" parameters:params class:[BPPicture 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(\\\"data\\\", new BuddyFile(new File(yourFile), fileType));\\nparameters.put(\\\"location\\\", myLocation);\\nparameters.put(\\\"caption\\\", \\\"This is an awesome picture caption!\\\");\\nparameters.put(\\\"tag\\\", \\\"Some useful tag\\\");\\nparameters.put(\\\"watermark\\\", \\\"My Watermark\\\");\\nparameters.put(\\\"readPermissions\\\", \\\"App\\\");\\nparameters.put(\\\"writePermissions\\\", \\\"User\\\");\\nparameters.put(\\\"title\\\", \\\"Some Title\\\");\\nparameters.put(\\\"useExifData\\\", true);\\n\\nBuddy.<Picture>post(\\\"/pictures\\\", parameters, new BuddyCallback<Picture>(Picture.class) {\\n\\[email protected]\\n\\tpublic void completed(BuddyResult<Picture> 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\\tdata = new BuddyFile(myFile.AsStream(), \\\"My File Name\\\", fileType),\\n\\t\\t\\tlocation = new BuddyGeoLocation(47.1, -122.3),\\n\\t\\t\\tcaption = \\\"This is an awesome picture caption!\\\",\\n\\t\\t\\ttag = \\\"Some useful tag\\\",\\n\\t\\t\\twatermark = \\\"My Watermark\\\",\\n\\t\\t\\treadPermissions = \\\"App\\\",\\n\\t\\t\\twritePermissions = \\\"User\\\",\\n\\t\\t\\ttitle = \\\"Some Title\\\",\\n\\t\\t\\tuseExifData = true\\n\\t\\t};\\n\\nvar result = await Buddy.PostAsync<Picture>(\\\"/pictures\\\", options);\",\n      \"language\": \"csharp\",\n      \"name\": \".NET\"\n    }\n  ],\n  \"sidebar\": true\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\": \"data\",\n    \"1-0\": \"location\",\n    \"2-0\": \"caption\",\n    \"3-0\": \"tag\",\n    \"4-0\": \"watermark\",\n    \"5-0\": \"readPermissions\",\n    \"6-0\": \"writePermissions\",\n    \"7-0\": \"title\",\n    \"8-0\": \"useExifData\",\n    \"0-1\": \"The binary picture data to be uploaded.\",\n    \"0-2\": \"file\",\n    \"1-1\": \"A location value, passed as a string in the format \\\"{latitude},{longitude}\\\" (e.g. \\\"47.1,-121.292\\\").\",\n    \"2-1\": \"The picture's caption.\",\n    \"3-1\": \"A string value to attach to this object. This value will be returned with the object as a property called tag.\",\n    \"4-1\": \"A string to add as a watermark to the photo. Buddy will overlay the photo with this text as a watermark.\",\n    \"5-1\": \"Specifies who can view this item. Values are User, only the user that created the value can view it, or App, meaning any app code can view the value.\",\n    \"6-1\": \"Specifies who can modify this item. Values are User, only the user that created the value can view it and modify it, or App, meaning any app code can view and modify the value.\",\n    \"7-1\": \"The title of the picture.\",\n    \"8-1\": \"Use any EXIF location and rotation data embedded in the picture. Default is true.\",\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    \"0-3\": \"Required\",\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  },\n  \"cols\": 4,\n  \"rows\": 9\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n    \\\"status\\\": 201,\\n    \\\"result\\\": {\\n        \\\"caption\\\": \\\"A great picture\\\",\\n        \\\"size\\\": {\\n            \\\"w\\\": 2476,\\n            \\\"h\\\": 1716\\n        },\\n        \\\"contentType\\\": \\\"image/png\\\",\\n        \\\"contentLength\\\": 29,\\n        \\\"signedUrl\\\": \\\"http://api-us.buddyplatform.com/pictures/bvc.PdttvruuGkqh/file?sig=%2B2rpuRoYriW6EHYODaHqF0%2FlmkfCIfZ6RtzxnYWTOQUhIf%2F5PA5TSr89J%2B282Z44fx0pmmtOtWgdC1HoXzxa5%2BURzkYCRrxsceYxFCMsTcwVNd0hV6ONyGjiNIP6BJ3MFqqfwVwbfwWDRT8mbyz%2BeSAJrVRlr8V30lvLmrh248O0VVK9rSPMx7DQA%2FeF925A\\\",\\n        \\\"id\\\": \\\"bvc.PduuvrBfGkqh\\\",\\n        \\\"location\\\": \\\"10,10\\\",\\n        \\\"created\\\": \\\"/Date(1392144584980)/\\\",\\n        \\\"lastModified\\\": \\\"/Date(1392144585540)/\\\",\\n        \\\"defaultMetadata\\\": \\\"RLE Encoding\\\"\\n    },\\n    \\\"request_id\\\": \\\"ac4e543e-3e30-4335-a29b-bc00ba693769\\\"\\n}\",\n      \"language\": \"json\",\n      \"name\": \"Response\"\n    }\n  ],\n  \"sidebar\": true\n}\n[/block]","excerpt":"","slug":"create-picture","type":"basic","title":"Create Picture"}
[block:api-header] { "type": "post", "title": "/pictures" } [/block] Uploads a new picture to Buddy. Most pictures are far below the Buddy file size restriction, however, please be considerate of upload time and data usage if the picture is coming from a mobile device. We recommend that the application utilizes local image manipulation tools to resize the photo before sending it over the network. [block:code] { "codes": [ { "code": "var options = {\n\tdata: \"{binary picture data}\",\n\tlocation: \"47.1, -121.292\",\n\tcaption: \"This is an awesome picture caption!\",\n\ttag: \"Some useful tag\",\n\twatermark: \"My Watermark\",\n\treadPermissions: \"App\",\n\twritePermissions: \"User\",\n\ttitle: \"Some Title\",\n\tuseExifData: true\n};\n\nBuddy.post('/pictures',\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", "name": null }, { "code": "NSDictionary *params = @{\n\t\t\[email protected]\"data\": myBpFile,\n\t\t\[email protected]\"location\": BPCoordinateMake(47.1, -121.292),\n\t\t\[email protected]\"caption\": @\"This is an awesome picture caption!\",\n\t\t\[email protected]\"tag\": @\"Some useful tag\",\n\t\t\[email protected]\"watermark\": @\"My Watermark\",\n\t\t\[email protected]\"readPermissions\": @\"App\",\n\t\t\[email protected]\"writePermissions\": @\"User\",\n\t\t\[email protected]\"title\": @\"Some Title\",\n\t\t\[email protected]\"useExifData\": true\n\t\t};\n\n[Buddy POST:@\"/pictures\" parameters:params class:[BPPicture 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(\"data\", new BuddyFile(new File(yourFile), fileType));\nparameters.put(\"location\", myLocation);\nparameters.put(\"caption\", \"This is an awesome picture caption!\");\nparameters.put(\"tag\", \"Some useful tag\");\nparameters.put(\"watermark\", \"My Watermark\");\nparameters.put(\"readPermissions\", \"App\");\nparameters.put(\"writePermissions\", \"User\");\nparameters.put(\"title\", \"Some Title\");\nparameters.put(\"useExifData\", true);\n\nBuddy.<Picture>post(\"/pictures\", parameters, new BuddyCallback<Picture>(Picture.class) {\n\[email protected]\n\tpublic void completed(BuddyResult<Picture> result) {\n\t\t// Your callback code here\n\t}\n});", "language": "java", "name": "Android" }, { "code": "var options = new {\n\t\t\tdata = new BuddyFile(myFile.AsStream(), \"My File Name\", fileType),\n\t\t\tlocation = new BuddyGeoLocation(47.1, -122.3),\n\t\t\tcaption = \"This is an awesome picture caption!\",\n\t\t\ttag = \"Some useful tag\",\n\t\t\twatermark = \"My Watermark\",\n\t\t\treadPermissions = \"App\",\n\t\t\twritePermissions = \"User\",\n\t\t\ttitle = \"Some Title\",\n\t\t\tuseExifData = true\n\t\t};\n\nvar result = await Buddy.PostAsync<Picture>(\"/pictures\", options);", "language": "csharp", "name": ".NET" } ], "sidebar": true } [/block] ###Body Parameters These parameters should be specified as part of the request body. [block:parameters] { "data": { "0-0": "data", "1-0": "location", "2-0": "caption", "3-0": "tag", "4-0": "watermark", "5-0": "readPermissions", "6-0": "writePermissions", "7-0": "title", "8-0": "useExifData", "0-1": "The binary picture data to be uploaded.", "0-2": "file", "1-1": "A location value, passed as a string in the format \"{latitude},{longitude}\" (e.g. \"47.1,-121.292\").", "2-1": "The picture's caption.", "3-1": "A string value to attach to this object. This value will be returned with the object as a property called tag.", "4-1": "A string to add as a watermark to the photo. Buddy will overlay the photo with this text as a watermark.", "5-1": "Specifies who can view this item. Values are User, only the user that created the value can view it, or App, meaning any app code can view the value.", "6-1": "Specifies who can modify this item. Values are User, only the user that created the value can view it and modify it, or App, meaning any app code can view and modify the value.", "7-1": "The title of the picture.", "8-1": "Use any EXIF location and rotation data embedded in the picture. Default is true.", "1-2": "string", "2-2": "string", "3-2": "string", "4-2": "string", "5-2": "string", "6-2": "string", "7-2": "string", "8-2": "string", "0-3": "Required", "1-3": "Optional", "2-3": "Optional", "3-3": "Optional", "4-3": "Optional", "5-3": "Optional", "6-3": "Optional", "7-3": "Optional", "8-3": "Optional" }, "cols": 4, "rows": 9 } [/block] [block:code] { "codes": [ { "code": "{\n \"status\": 201,\n \"result\": {\n \"caption\": \"A great picture\",\n \"size\": {\n \"w\": 2476,\n \"h\": 1716\n },\n \"contentType\": \"image/png\",\n \"contentLength\": 29,\n \"signedUrl\": \"http://api-us.buddyplatform.com/pictures/bvc.PdttvruuGkqh/file?sig=%2B2rpuRoYriW6EHYODaHqF0%2FlmkfCIfZ6RtzxnYWTOQUhIf%2F5PA5TSr89J%2B282Z44fx0pmmtOtWgdC1HoXzxa5%2BURzkYCRrxsceYxFCMsTcwVNd0hV6ONyGjiNIP6BJ3MFqqfwVwbfwWDRT8mbyz%2BeSAJrVRlr8V30lvLmrh248O0VVK9rSPMx7DQA%2FeF925A\",\n \"id\": \"bvc.PduuvrBfGkqh\",\n \"location\": \"10,10\",\n \"created\": \"/Date(1392144584980)/\",\n \"lastModified\": \"/Date(1392144585540)/\",\n \"defaultMetadata\": \"RLE Encoding\"\n },\n \"request_id\": \"ac4e543e-3e30-4335-a29b-bc00ba693769\"\n}", "language": "json", "name": "Response" } ], "sidebar": true } [/block]