{"action":"created","issue":{"url":"https://api.github.com/repos/sul-dlss/triannon/issues/139","labels_url":"https://api.github.com/repos/sul-dlss/triannon/issues/139/labels{/name}","comments_url":"https://api.github.com/repos/sul-dlss/triannon/issues/139/comments","events_url":"https://api.github.com/repos/sul-dlss/triannon/issues/139/events","html_url":"https://github.com/sul-dlss/triannon/issues/139","id":62551159,"number":139,"title":"POST generates internal server error 500","user":{"login":"darrenleeweber","id":240623,"avatar_url":"https://avatars.githubusercontent.com/u/240623?v=3","gravatar_id":"","url":"https://api.github.com/users/darrenleeweber","html_url":"https://github.com/darrenleeweber","followers_url":"https://api.github.com/users/darrenleeweber/followers","following_url":"https://api.github.com/users/darrenleeweber/following{/other_user}","gists_url":"https://api.github.com/users/darrenleeweber/gists{/gist_id}","starred_url":"https://api.github.com/users/darrenleeweber/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/darrenleeweber/subscriptions","organizations_url":"https://api.github.com/users/darrenleeweber/orgs","repos_url":"https://api.github.com/users/darrenleeweber/repos","events_url":"https://api.github.com/users/darrenleeweber/events{/privacy}","received_events_url":"https://api.github.com/users/darrenleeweber/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":{"login":"darrenleeweber","id":240623,"avatar_url":"https://avatars.githubusercontent.com/u/240623?v=3","gravatar_id":"","url":"https://api.github.com/users/darrenleeweber","html_url":"https://github.com/darrenleeweber","followers_url":"https://api.github.com/users/darrenleeweber/followers","following_url":"https://api.github.com/users/darrenleeweber/following{/other_user}","gists_url":"https://api.github.com/users/darrenleeweber/gists{/gist_id}","starred_url":"https://api.github.com/users/darrenleeweber/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/darrenleeweber/subscriptions","organizations_url":"https://api.github.com/users/darrenleeweber/orgs","repos_url":"https://api.github.com/users/darrenleeweber/repos","events_url":"https://api.github.com/users/darrenleeweber/events{/privacy}","received_events_url":"https://api.github.com/users/darrenleeweber/received_events","type":"User","site_admin":false},"milestone":null,"comments":4,"created_at":"2015-03-18T00:43:16Z","updated_at":"2015-03-24T19:09:15Z","closed_at":"2015-03-24T19:09:15Z","body":"Ran triannon using `rake triannon:server_jetty` and the console trace contains:\r\n\r\n```\r\nStarted POST \"/annotations/\" for 127.0.0.1 at 2015-03-17 17:32:28 -0700\r\nProcessing by Triannon::AnnotationsController#create as XML\r\n  Parameters: {\"@context\"=>{\"oa\"=>\"http://www.w3.org/ns/oa#\", \"cnt\"=>\"http://www.w3.org/2011/content#\", \"dc\"=>\"http://purl.org/dc/elements/1.1/\", \"dcterms\"=>\"http://purl.org/dc/terms/\", \"dctypes\"=>\"http://purl.org/dc/dcmitype/\", \"foaf\"=>\"http://xmlns.com/foaf/0.1/\", \"rdf\"=>\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\", \"rdfs\"=>\"http://www.w3.org/2000/01/rdf-schema#\", \"skos\"=>\"http://www.w3.org/2004/02/skos/core#\", \"owl\"=>\"http://www.w3.org/2002/07/owl#\", \"prov\"=>\"http://www.w3.org/ns/prov#\", \"trig\"=>\"http://www.w3.org/2004/03/trix/rdfg-1/\", \"xsd\"=>\"http://www.w3.org/2001/XMLSchema#\", \"hasBody\"=>{\"@type\"=>\"@id\", \"@id\"=>\"oa:hasBody\"}, \"hasTarget\"=>{\"@type\"=>\"@id\", \"@id\"=>\"oa:hasTarget\"}, \"hasSource\"=>{\"@type\"=>\"@id\", \"@id\"=>\"oa:hasSource\"}, \"hasSelector\"=>{\"@type\"=>\"@id\", \"@id\"=>\"oa:hasSelector\"}, \"hasState\"=>{\"@type\"=>\"@id\", \"@id\"=>\"oa:hasState\"}, \"hasScope\"=>{\"@type\"=>\"@id\", \"@id\"=>\"oa:hasScope\"}, \"annotatedBy\"=>{\"@type\"=>\"@id\", \"@id\"=>\"oa:annotatedBy\"}, \"serializedBy\"=>{\"@type\"=>\"@id\", \"@id\"=>\"oa:serializedBy\"}, \"motivatedBy\"=>{\"@type\"=>\"@id\", \"@id\"=>\"oa:motivatedBy\"}, \"equivalentTo\"=>{\"@type\"=>\"@id\", \"@id\"=>\"oa:equivalentTo\"}, \"styledBy\"=>{\"@type\"=>\"@id\", \"@id\"=>\"oa:styledBy\"}, \"cachedSource\"=>{\"@type\"=>\"@id\", \"@id\"=>\"oa:cachedSource\"}, \"conformsTo\"=>{\"@type\"=>\"@id\", \"@id\"=>\"dcterms:conformsTo\"}, \"default\"=>{\"@type\"=>\"@id\", \"@id\"=>\"oa:default\"}, \"item\"=>{\"@type\"=>\"@id\", \"@id\"=>\"oa:item\"}, \"first\"=>{\"@type\"=>\"@id\", \"@id\"=>\"rdf:first\"}, \"rest\"=>{\"@type\"=>\"@id\", \"@id\"=>\"rdf:rest\", \"@container\"=>\"@list\"}, \"annotatedAt\"=>{\"@type\"=>\"xsd:dateTimeStamp\", \"@id\"=>\"oa:annotatedAt\"}, \"end\"=>{\"@type\"=>\"xsd:nonNegativeInteger\", \"@id\"=>\"oa:end\"}, \"exact\"=>\"oa:exact\", \"prefix\"=>\"oa:prefix\", \"serializedAt\"=>{\"@type\"=>\"xsd:dateTimeStamp\", \"@id\"=>\"oa:serializedAt\"}, \"start\"=>{\"@type\"=>\"xsd:nonNegativeInteger\", \"@id\"=>\"oa:start\"}, \"styleClass\"=>\"oa:styleClass\", \"suffix\"=>\"oa:suffix\", \"when\"=>{\"@type\"=>\"xsd:dateTimeStamp\", \"@id\"=>\"oa:when\"}, \"chars\"=>\"cnt:chars\", \"bytes\"=>\"cnt:bytes\", \"format\"=>\"dc:format\", \"language\"=>\"dc:language\", \"value\"=>\"rdf:value\", \"label\"=>\"rdfs:label\", \"name\"=>\"foaf:name\", \"mbox\"=>\"foaf:mbox\"}, \"@graph\"=>[{\"@id\"=>\"_:b92\", \"@type\"=>\"oa:Annotation\", \"hasBody\"=>\"_:b93\", \"hasTarget\"=>\"http://dms-data.stanford.edu/data/manifests/BnF/jr903ng8662/canvas/canvas-60#xywh=441,3599,1363,58\", \"motivatedBy\"=>\"sc:painting\", \"oa:serializedAt\"=>{\"@value\"=>\"2015-03-18T00:32:28Z\", \"@type\"=>\"xsd:dateTime\"}, \"serializedBy\"=>\"https://github.com/sul-dlss/annotations2triannon\"}, {\"@id\"=>\"_:b93\", \"@type\"=>\"cnt:ContentAsText\", \"chars\"=>\"Ne deffaites ou desdittes\", \"format\"=>\"text/plain\", \"language\"=>\"frm\"}], \"annotation\"=>{\"@context\"=>{\"oa\"=>\"http://www.w3.org/ns/oa#\", \"cnt\"=>\"http://www.w3.org/2011/content#\", \"dc\"=>\"http://purl.org/dc/elements/1.1/\", \"dcterms\"=>\"http://purl.org/dc/terms/\", \"dctypes\"=>\"http://purl.org/dc/dcmitype/\", \"foaf\"=>\"http://xmlns.com/foaf/0.1/\", \"rdf\"=>\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\", \"rdfs\"=>\"http://www.w3.org/2000/01/rdf-schema#\", \"skos\"=>\"http://www.w3.org/2004/02/skos/core#\", \"owl\"=>\"http://www.w3.org/2002/07/owl#\", \"prov\"=>\"http://www.w3.org/ns/prov#\", \"trig\"=>\"http://www.w3.org/2004/03/trix/rdfg-1/\", \"xsd\"=>\"http://www.w3.org/2001/XMLSchema#\", \"hasBody\"=>{\"@type\"=>\"@id\", \"@id\"=>\"oa:hasBody\"}, \"hasTarget\"=>{\"@type\"=>\"@id\", \"@id\"=>\"oa:hasTarget\"}, \"hasSource\"=>{\"@type\"=>\"@id\", \"@id\"=>\"oa:hasSource\"}, \"hasSelector\"=>{\"@type\"=>\"@id\", \"@id\"=>\"oa:hasSelector\"}, \"hasState\"=>{\"@type\"=>\"@id\", \"@id\"=>\"oa:hasState\"}, \"hasScope\"=>{\"@type\"=>\"@id\", \"@id\"=>\"oa:hasScope\"}, \"annotatedBy\"=>{\"@type\"=>\"@id\", \"@id\"=>\"oa:annotatedBy\"}, \"serializedBy\"=>{\"@type\"=>\"@id\", \"@id\"=>\"oa:serializedBy\"}, \"motivatedBy\"=>{\"@type\"=>\"@id\", \"@id\"=>\"oa:motivatedBy\"}, \"equivalentTo\"=>{\"@type\"=>\"@id\", \"@id\"=>\"oa:equivalentTo\"}, \"styledBy\"=>{\"@type\"=>\"@id\", \"@id\"=>\"oa:styledBy\"}, \"cachedSource\"=>{\"@type\"=>\"@id\", \"@id\"=>\"oa:cachedSource\"}, \"conformsTo\"=>{\"@type\"=>\"@id\", \"@id\"=>\"dcterms:conformsTo\"}, \"default\"=>{\"@type\"=>\"@id\", \"@id\"=>\"oa:default\"}, \"item\"=>{\"@type\"=>\"@id\", \"@id\"=>\"oa:item\"}, \"first\"=>{\"@type\"=>\"@id\", \"@id\"=>\"rdf:first\"}, \"rest\"=>{\"@type\"=>\"@id\", \"@id\"=>\"rdf:rest\", \"@container\"=>\"@list\"}, \"annotatedAt\"=>{\"@type\"=>\"xsd:dateTimeStamp\", \"@id\"=>\"oa:annotatedAt\"}, \"end\"=>{\"@type\"=>\"xsd:nonNegativeInteger\", \"@id\"=>\"oa:end\"}, \"exact\"=>\"oa:exact\", \"prefix\"=>\"oa:prefix\", \"serializedAt\"=>{\"@type\"=>\"xsd:dateTimeStamp\", \"@id\"=>\"oa:serializedAt\"}, \"start\"=>{\"@type\"=>\"xsd:nonNegativeInteger\", \"@id\"=>\"oa:start\"}, \"styleClass\"=>\"oa:styleClass\", \"suffix\"=>\"oa:suffix\", \"when\"=>{\"@type\"=>\"xsd:dateTimeStamp\", \"@id\"=>\"oa:when\"}, \"chars\"=>\"cnt:chars\", \"bytes\"=>\"cnt:bytes\", \"format\"=>\"dc:format\", \"language\"=>\"dc:language\", \"value\"=>\"rdf:value\", \"label\"=>\"rdfs:label\", \"name\"=>\"foaf:name\", \"mbox\"=>\"foaf:mbox\"}, \"@graph\"=>[{\"@id\"=>\"_:b92\", \"@type\"=>\"oa:Annotation\", \"hasBody\"=>\"_:b93\", \"hasTarget\"=>\"http://dms-data.stanford.edu/data/manifests/BnF/jr903ng8662/canvas/canvas-60#xywh=441,3599,1363,58\", \"motivatedBy\"=>\"sc:painting\", \"oa:serializedAt\"=>{\"@value\"=>\"2015-03-18T00:32:28Z\", \"@type\"=>\"xsd:dateTime\"}, \"serializedBy\"=>\"https://github.com/sul-dlss/annotations2triannon\"}, {\"@id\"=>\"_:b93\", \"@type\"=>\"cnt:ContentAsText\", \"chars\"=>\"Ne deffaites ou desdittes\", \"format\"=>\"text/plain\", \"language\"=>\"frm\"}]}}\r\nUnpermitted parameters: @context, @graph\r\nCompleted 500 Internal Server Error in 1ms\r\n\r\nNoMethodError (undefined method `save' for nil:NilClass):\r\n  /data/src/dlss/ld4l_data/annotations/triannon/app/controllers/triannon/annotations_controller.rb:75:in `create'\r\n  actionpack (4.2.0) lib/action_controller/metal/implicit_render.rb:4:in `send_action'\r\n  actionpack (4.2.0) lib/abstract_controller/base.rb:198:in `process_action'\r\n```\r\n\r\nThe POST was done with RestClient, using:\r\n\r\n```\r\nsite = RestClient::Resource.new('http://localhost:3000', :user => '', :password => '')\r\nresponse = site[\"/annotations/\"].post oa_jsonld, :content_type => :json\r\n```\r\n\r\nwhere the `oa_jsonld` data is an open annotation with an OA context (in full, not as a URI), e.g.\r\n\r\n```\r\n{\r\n  \"@context\": {\r\n    \"oa\": \"http://www.w3.org/ns/oa#\",\r\n    \"cnt\": \"http://www.w3.org/2011/content#\",\r\n    \"dc\": \"http://purl.org/dc/elements/1.1/\",\r\n    \"dcterms\": \"http://purl.org/dc/terms/\",\r\n    \"dctypes\": \"http://purl.org/dc/dcmitype/\",\r\n    \"foaf\": \"http://xmlns.com/foaf/0.1/\",\r\n    \"rdf\": \"http://www.w3.org/1999/02/22-rdf-syntax-ns#\",\r\n    \"rdfs\": \"http://www.w3.org/2000/01/rdf-schema#\",\r\n    \"skos\": \"http://www.w3.org/2004/02/skos/core#\",\r\n    \"owl\": \"http://www.w3.org/2002/07/owl#\",\r\n    \"prov\": \"http://www.w3.org/ns/prov#\",\r\n    \"trig\": \"http://www.w3.org/2004/03/trix/rdfg-1/\",\r\n    \"xsd\": \"http://www.w3.org/2001/XMLSchema#\",\r\n    \"hasBody\": {\r\n      \"@type\": \"@id\",\r\n      \"@id\": \"oa:hasBody\"\r\n    },\r\n    \"hasTarget\": {\r\n      \"@type\": \"@id\",\r\n      \"@id\": \"oa:hasTarget\"\r\n    },\r\n    \"hasSource\": {\r\n      \"@type\": \"@id\",\r\n      \"@id\": \"oa:hasSource\"\r\n    },\r\n    \"hasSelector\": {\r\n      \"@type\": \"@id\",\r\n      \"@id\": \"oa:hasSelector\"\r\n    },\r\n    \"hasState\": {\r\n      \"@type\": \"@id\",\r\n      \"@id\": \"oa:hasState\"\r\n    },\r\n    \"hasScope\": {\r\n      \"@type\": \"@id\",\r\n      \"@id\": \"oa:hasScope\"\r\n    },\r\n    \"annotatedBy\": {\r\n      \"@type\": \"@id\",\r\n      \"@id\": \"oa:annotatedBy\"\r\n    },\r\n    \"serializedBy\": {\r\n      \"@type\": \"@id\",\r\n      \"@id\": \"oa:serializedBy\"\r\n    },\r\n    \"motivatedBy\": {\r\n      \"@type\": \"@id\",\r\n      \"@id\": \"oa:motivatedBy\"\r\n    },\r\n    \"equivalentTo\": {\r\n      \"@type\": \"@id\",\r\n      \"@id\": \"oa:equivalentTo\"\r\n    },\r\n    \"styledBy\": {\r\n      \"@type\": \"@id\",\r\n      \"@id\": \"oa:styledBy\"\r\n    },\r\n    \"cachedSource\": {\r\n      \"@type\": \"@id\",\r\n      \"@id\": \"oa:cachedSource\"\r\n    },\r\n    \"conformsTo\": {\r\n      \"@type\": \"@id\",\r\n      \"@id\": \"dcterms:conformsTo\"\r\n    },\r\n    \"default\": {\r\n      \"@type\": \"@id\",\r\n      \"@id\": \"oa:default\"\r\n    },\r\n    \"item\": {\r\n      \"@type\": \"@id\",\r\n      \"@id\": \"oa:item\"\r\n    },\r\n    \"first\": {\r\n      \"@type\": \"@id\",\r\n      \"@id\": \"rdf:first\"\r\n    },\r\n    \"rest\": {\r\n      \"@type\": \"@id\",\r\n      \"@id\": \"rdf:rest\",\r\n      \"@container\": \"@list\"\r\n    },\r\n    \"annotatedAt\": {\r\n      \"@type\": \"xsd:dateTimeStamp\",\r\n      \"@id\": \"oa:annotatedAt\"\r\n    },\r\n    \"end\": {\r\n      \"@type\": \"xsd:nonNegativeInteger\",\r\n      \"@id\": \"oa:end\"\r\n    },\r\n    \"exact\": \"oa:exact\",\r\n    \"prefix\": \"oa:prefix\",\r\n    \"serializedAt\": {\r\n      \"@type\": \"xsd:dateTimeStamp\",\r\n      \"@id\": \"oa:serializedAt\"\r\n    },\r\n    \"start\": {\r\n      \"@type\": \"xsd:nonNegativeInteger\",\r\n      \"@id\": \"oa:start\"\r\n    },\r\n    \"styleClass\": \"oa:styleClass\",\r\n    \"suffix\": \"oa:suffix\",\r\n    \"when\": {\r\n      \"@type\": \"xsd:dateTimeStamp\",\r\n      \"@id\": \"oa:when\"\r\n    },\r\n    \"chars\": \"cnt:chars\",\r\n    \"bytes\": \"cnt:bytes\",\r\n    \"format\": \"dc:format\",\r\n    \"language\": \"dc:language\",\r\n    \"value\": \"rdf:value\",\r\n    \"label\": \"rdfs:label\",\r\n    \"name\": \"foaf:name\",\r\n    \"mbox\": \"foaf:mbox\"\r\n  },\r\n  \"@graph\": [\r\n    {\r\n      \"@id\": \"_:b92\",\r\n      \"@type\": \"oa:Annotation\",\r\n      \"hasBody\": \"_:b93\",\r\n      \"hasTarget\": \"http://dms-data.stanford.edu/data/manifests/BnF/jr903ng8662/canvas/canvas-60#xywh=441,3599,1363,58\",\r\n      \"motivatedBy\": \"sc:painting\",\r\n      \"oa:serializedAt\": {\r\n        \"@value\": \"2015-03-18T00:41:41Z\",\r\n        \"@type\": \"xsd:dateTime\"\r\n      },\r\n      \"serializedBy\": \"https://github.com/sul-dlss/annotations2triannon\"\r\n    },\r\n    {\r\n      \"@id\": \"_:b93\",\r\n      \"@type\": \"cnt:ContentAsText\",\r\n      \"chars\": \"Ne deffaites ou desdittes\",\r\n      \"format\": \"text/plain\",\r\n      \"language\": \"frm\"\r\n    }\r\n  ]\r\n}\r\n```\r\n\r\nWithout the OA context, the annotation has the following json representation:\r\n\r\n```\r\n{\r\n  \"@context\": {\r\n    \"content\": \"http://www.w3.org/2011/content#\",\r\n    \"dc11\": \"http://purl.org/dc/elements/1.1/\",\r\n    \"oa\": \"http://www.w3.org/ns/oa#\",\r\n    \"sc\": \"http://www.shared-canvas.org/ns/\",\r\n    \"xsd\": \"http://www.w3.org/2001/XMLSchema#\"\r\n  },\r\n  \"@graph\": [\r\n    {\r\n      \"@id\": \"_:b92\",\r\n      \"@type\": \"oa:Annotation\",\r\n      \"oa:hasBody\": {\r\n        \"@id\": \"_:b93\"\r\n      },\r\n      \"oa:hasTarget\": {\r\n        \"@id\": \"http://dms-data.stanford.edu/data/manifests/BnF/jr903ng8662/canvas/canvas-60#xywh=441,3599,1363,58\"\r\n      },\r\n      \"oa:motivatedBy\": {\r\n        \"@id\": \"sc:painting\"\r\n      },\r\n      \"oa:serializedAt\": {\r\n        \"@value\": \"2015-03-18T00:42:21Z\",\r\n        \"@type\": \"xsd:dateTime\"\r\n      },\r\n      \"oa:serializedBy\": {\r\n        \"@id\": \"https://github.com/sul-dlss/annotations2triannon\"\r\n      }\r\n    },\r\n    {\r\n      \"@id\": \"_:b93\",\r\n      \"@type\": \"content:ContentAsText\",\r\n      \"content:chars\": \"Ne deffaites ou desdittes\",\r\n      \"dc11:format\": \"text/plain\",\r\n      \"dc11:language\": \"frm\"\r\n    }\r\n  ]\r\n}\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/sul-dlss/triannon/issues/comments/85647624","html_url":"https://github.com/sul-dlss/triannon/issues/139#issuecomment-85647624","issue_url":"https://api.github.com/repos/sul-dlss/triannon/issues/139","id":85647624,"user":{"login":"darrenleeweber","id":240623,"avatar_url":"https://avatars.githubusercontent.com/u/240623?v=3","gravatar_id":"","url":"https://api.github.com/users/darrenleeweber","html_url":"https://github.com/darrenleeweber","followers_url":"https://api.github.com/users/darrenleeweber/followers","following_url":"https://api.github.com/users/darrenleeweber/following{/other_user}","gists_url":"https://api.github.com/users/darrenleeweber/gists{/gist_id}","starred_url":"https://api.github.com/users/darrenleeweber/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/darrenleeweber/subscriptions","organizations_url":"https://api.github.com/users/darrenleeweber/orgs","repos_url":"https://api.github.com/users/darrenleeweber/repos","events_url":"https://api.github.com/users/darrenleeweber/events{/privacy}","received_events_url":"https://api.github.com/users/darrenleeweber/received_events","type":"User","site_admin":false},"created_at":"2015-03-24T19:09:15Z","updated_at":"2015-03-24T19:09:15Z","body":"This was solved by wrapping the post data with additional params, i.e.\r\n```\r\npost_data = {\r\n        \"commit\" => \"Create Annotation\",\r\n        \"annotation\" => { \"data\" => oa.to_jsonld_oa }\r\n      }\r\n```\r\n"}}