{"action":"created","issue":{"url":"https://api.github.com/repos/collectiveaccess/providence/issues/212","labels_url":"https://api.github.com/repos/collectiveaccess/providence/issues/212/labels{/name}","comments_url":"https://api.github.com/repos/collectiveaccess/providence/issues/212/comments","events_url":"https://api.github.com/repos/collectiveaccess/providence/issues/212/events","html_url":"https://github.com/collectiveaccess/providence/pull/212","id":97304483,"number":212,"title":"NOJIRA : add representation through ItemService WebService","user":{"login":"gautiermichelin","id":314697,"avatar_url":"https://avatars.githubusercontent.com/u/314697?v=3","gravatar_id":"","url":"https://api.github.com/users/gautiermichelin","html_url":"https://github.com/gautiermichelin","followers_url":"https://api.github.com/users/gautiermichelin/followers","following_url":"https://api.github.com/users/gautiermichelin/following{/other_user}","gists_url":"https://api.github.com/users/gautiermichelin/gists{/gist_id}","starred_url":"https://api.github.com/users/gautiermichelin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gautiermichelin/subscriptions","organizations_url":"https://api.github.com/users/gautiermichelin/orgs","repos_url":"https://api.github.com/users/gautiermichelin/repos","events_url":"https://api.github.com/users/gautiermichelin/events{/privacy}","received_events_url":"https://api.github.com/users/gautiermichelin/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-07-26T10:04:21Z","updated_at":"2015-07-26T13:44:58Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/collectiveaccess/providence/pulls/212","html_url":"https://github.com/collectiveaccess/providence/pull/212","diff_url":"https://github.com/collectiveaccess/providence/pull/212.diff","patch_url":"https://github.com/collectiveaccess/providence/pull/212.patch"},"body":"Hi @skeidel  & @SethKaufman \r\n\r\nThis PR implements addRepresentation to ca_objects through Web Services (ItemService).\r\nI'm bringing it to allow representation upload through my Titanium mobile app for ipad (called Newport, I thought a Rhode Island city name could be a tribute to Seth huge work).\r\n\r\nThis is fairly working through my tests, this is a early pull request to have your look inside this piece of code, and see if this could manage to go to the master branch in the future.\r\n\r\nSyntax for the body request to http://providence.dev/service.php/item/ca_objects/id/14 is this one :\r\n````json\r\n{\r\n    \"intrinsic_fields\" : {\r\n        \"idno\" : \"TEST-123\",\r\n        \"type_id\" : 24\r\n    },\r\n    \"preferred_labels\" : [\r\n        {\r\n            \"locale\" : \"en_US\",\r\n          \"name\" : \"test 1\"\r\n        }\r\n    ],\r\n    \"add_representations\" : [\r\n      {\r\n        \"filename\" : \"icon.jpg\",\r\n        \"media_content\" : \"/9j/4AAQSkZJRgABAQAAAQABAAD//gA7Q1JFQVRPUjogZ2QtanBlZyB2MS4wICh1c2luZyBJSkcgSlBFRyB2NjIpLCBxdWFsaXR5ID0gOTMK/9sAQwACAgICAgECAgICAwICAwMGBAMDAwMHBQUEBggHCQgIBwgICQoNCwkKDAoICAsPCwwNDg4PDgkLEBEQDhENDg4O/9sAQwECAwMDAwMHBAQHDgkICQ4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4O/8AAEQgAMAAwAwEiAAIRAQMRAf/EAB8AAAEFAQEBAQEBAAAAAAAAAAABAgMEBQYHCAkKC//EALUQAAIBAwMCBAMFBQQEAAABfQECAwAEEQUSITFBBhNRYQcicRQygZGhCCNCscEVUtHwJDNicoIJChYXGBkaJSYnKCkqNDU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6g4SFhoeIiYqSk5SVlpeYmZqio6Slpqeoqaqys7S1tre4ubrCw8TFxsfIycrS09TV1tfY2drh4uPk5ebn6Onq8fLz9PX29/j5+v/EAB8BAAMBAQEBAQEBAQEAAAAAAAABAgMEBQYHCAkKC//EALURAAIBAgQEAwQHBQQEAAECdwABAgMRBAUhMQYSQVEHYXETIjKBCBRCkaGxwQkjM1LwFWJy0QoWJDThJfEXGBkaJicoKSo1Njc4OTpDREVGR0hJSlNUVVZXWFlaY2RlZmdoaWpzdHV2d3h5eoKDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDx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eCCOur4W8BeN7Lxf4W1ez+KF7eeCIYzcyaTf6fG93ciSLCRSXAxuRd24YRTkDJNeZhf9ZsDiIUcQo4ii3bnXuTiu8ovSS84u7fRHbUhldeDnRm6ckr8stU/KMkuvmkvM634s2dtrf7N3jjSSySXEujTvbxtzmZEMkf/AI+q1+dvwa8e2vh2K10a7lV9O1WFb+xbzgrvKQI7kxlyFdfNjldlBDKSSN4kxH+iPj7w7qN7oE93oshF4qHMJPyye1fBOifAvVde+C6eC/FPgm9aTS9SlfR7m1uBDJbpkMsiyA5Vt5c46YODwSK+8i0j56SufX/hvV7TWPD9lqVlL51rcRh4274PYjsQeCOxBFegWd0rMqq3yDqa+T/AfwL+MHhS2Npo/iwWWlvIXlh1GIXDPweSPuhsnJZApY43bsDHs9l8IPGVxEBr3xEvpQeq2Si22/Qx4NW3ESTPbLm6tf7FPmXEaYHdxVDwZfQXfhW4gguFulsr6a38xWDKRu3qAR6K6r+FcDB8CvCToP7bnvvET5zu1G5aY/m2TXq+jaNp2gaBBpelW62tlCMRxL0UVlpYvW5//9k=\",\r\n        \"primary\" : \"true\"\r\n      },\r\n     {\r\n        \"media_path\" : \"http://www.collectiveaccess.org/sites/all/themes/collectiveaccess/img/body_logo.png\",\r\n        \"primary\" : \"false\"\r\n     }\r\n    ]\r\n}\r\n````\r\n\r\nIt brings the usual base64 overweight to the request, but everything is sent in the body.\r\n\r\nWishing you a sunny sunday,\r\nBye,\r\n\r\nGautier"},"comment":{"url":"https://api.github.com/repos/collectiveaccess/providence/issues/comments/124988772","html_url":"https://github.com/collectiveaccess/providence/pull/212#issuecomment-124988772","issue_url":"https://api.github.com/repos/collectiveaccess/providence/issues/212","id":124988772,"user":{"login":"skeidel","id":1188614,"avatar_url":"https://avatars.githubusercontent.com/u/1188614?v=3","gravatar_id":"","url":"https://api.github.com/users/skeidel","html_url":"https://github.com/skeidel","followers_url":"https://api.github.com/users/skeidel/followers","following_url":"https://api.github.com/users/skeidel/following{/other_user}","gists_url":"https://api.github.com/users/skeidel/gists{/gist_id}","starred_url":"https://api.github.com/users/skeidel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/skeidel/subscriptions","organizations_url":"https://api.github.com/users/skeidel/orgs","repos_url":"https://api.github.com/users/skeidel/repos","events_url":"https://api.github.com/users/skeidel/events{/privacy}","received_events_url":"https://api.github.com/users/skeidel/received_events","type":"User","site_admin":false},"created_at":"2015-07-26T13:44:58Z","updated_at":"2015-07-26T13:44:58Z","body":"Why so complicated? You can already add media by using PUT requests to the item service (ca_object_representations table) and passing either a local media path (/data/foo/bar.tiff) or a URL (http://mysite.org/foo/bar.tiff, if pulling media from URLs is enabled in app.conf) to the intrinsic 'media' field.\r\n\r\nI [just implemented](https://github.com/skeidel/alhalqa-erzaehlbox/blob/master/upload.rb#L29) a Ruby script for a kiosk-like app one of my clients is going to run in an exhibition yesterday. \r\n\r\nI am on board with adding support for inline base64-encoded media; that could come in handy when dealing with mobile apps where uploading to the server or accessing via http[s] is not an option, but I would want to steer away from the \"addRepresentation\" hack."}}