API Item POST Woes

Hey all,

I have an odd issue that's been driving me nutty for the past few days. I work in a Windows environment, and used C# to create a REST client. I have had intermittent success creating Items and adding Files via the REST API. The issue that's been baffling me is that for reasons unknown, the API will start returning 404 errors for item-creation. The items actually ARE created in Omeka, but the API response is useless to me since it does not contain the created item's ID for me to POST files to. I am running this client locally, and have tried every conceivable URI to resolve what I _think_ is a routing issue. What frustrates me most is that this issue occurs without any obvious cause. I have used raw JSON and Postman (a browser-based REST client) to troubleshoot, but the resulting errors are inconclusive.

HELP!

Thanks,
-Fitz

Do the errors still occur with your other forms of testing (raw requests and Postman)?

I'm not aware of any other complaints like this, so this could be hard to run down without some idea of what might be the factors that cause the problem.

Yes, I'm sorry I didn't clarify that. I should note that I've experienced this issue on two separate Omeka servers. Also, these instances are on a WAMP stack although I plan on migrating them to an Oracle server eventually. Is there any particular log-file you could suggest I inspect?

Thanks,
-Fitz

PS: I POSTed the same data to my Oracle instance without error; the JSON response was as expected.

Could you add an example of the bad JSON from WAMP, and an example of the good JSON from Oracle?

Thanks

Hi Patrick,

Here's the request JSON (standard test case):

{
"item_type": {"id": 1},
"collection": null,
"public": true,
"featured": false,
"tags": [
{"name": "foo"},
{"name": "bar"}
],
"element_texts": [
{
"html": false,
"text": "Lorem ipsum dolor sit amet, consectetur adipiscing elit.",
"element": {"id": 1}
}
]
}

Here's the WAMP response (although the item _IS_ created in Omeka:

{
"message": "'404' Status: Not Found"
}

Here's the Oracle response:

{
"id": 1009,
"url": "https://exhibit.hsclib/api/items/1009",
"public": true,
"featured": true,
"added": "2015-08-04T18:20:47+00:00",
"modified": "2015-08-04T18:20:47+00:00",
"item_type": null,
"collection": null,
"owner": {
"id": 1,
"url": "https://exhibit.hsclib/api/users/1",
"resource": "users"
},
"files": {
"count": 0,
"url": "https://exhibit.hsclib/api/files?item=1009",
"resource": "files"
},
"tags": [
{
"id": 14,
"url": "https://exhibit.hsclib/api/tags/14",
"name": "tag1",
"resource": "tags"
},
{
"id": 15,
"url": "https://exhibit.hsclib/api/tags/15",
"name": "tag2",
"resource": "tags"
}
],
"element_texts": [
{
"html": false,
"text": "mfp-05-04-016-005b",
"element_set": {
"id": 1,
"url": "https://exhibit.hsclib/api/element_sets/1",
"name": "Dublin Core",
"resource": "element_sets"
},
"element": {
"id": 50,
"url": "https://exhibit.hsclib/api/elements/50",
"name": "Title",
"resource": "elements"
}
},
{
"html": false,
"text": "mfp-05-04-016-005b",
"element_set": {
"id": 1,
"url": "https://exhibit.hsclib/api/element_sets/1",
"name": "Dublin Core",
"resource": "element_sets"
},
"element": {
"id": 49,
"url": "https://exhibit.hsclib/api/elements/49",
"name": "Subject",
"resource": "elements"
}
}
],
"extended_resources": {
"exhibit_pages": {
"count": 0,
"url": "https://exhibit.hsclib/api/exhibit_pages?item=1009",
"resource": "exhibit_pages"
}
}
}

Hey all,

FYI: I set up a 2nd Omeka instance on the WAMP server in a separate directory, and did a bare-bones API POST of an item, and it worked as expected. I'm really baffled. I used the error-throwing instance just last night to import a couple of thousand items and their respective files without a hitch. Here's the response:

{
"id": 1,
"url": "http://096-217.lib/omeka-2.3/api/items/1",
"public": true,
"featured": true,
"added": "2015-08-04T18:57:20+00:00",
"modified": "2015-08-04T18:57:20+00:00",
"item_type": null,
"collection": null,
"owner": {
"id": 1,
"url": "http://096-217.lib/omeka-2.3/api/users/1",
"resource": "users"
},
"files": {
"count": 0,
"url": "http://096-217.lib/omeka-2.3/api/files?item=1",
"resource": "files"
},
"tags": [
{
"id": 1,
"url": "http://096-217.lib/omeka-2.3/api/tags/1",
"name": "tag1",
"resource": "tags"
},
{
"id": 2,
"url": "http://096-217.lib/omeka-2.3/api/tags/2",
"name": "tag2",
"resource": "tags"
}
],
"element_texts": [
{
"html": false,
"text": "mfp-05-04-016-005b",
"element_set": {
"id": 1,
"url": "http://096-217.lib/omeka-2.3/api/element_sets/1",
"name": "Dublin Core",
"resource": "element_sets"
},
"element": {
"id": 50,
"url": "http://096-217.lib/omeka-2.3/api/elements/50",
"name": "Title",
"resource": "elements"
}
},
{
"html": false,
"text": "mfp-05-04-016-005b",
"element_set": {
"id": 1,
"url": "http://096-217.lib/omeka-2.3/api/element_sets/1",
"name": "Dublin Core",
"resource": "element_sets"
},
"element": {
"id": 49,
"url": "http://096-217.lib/omeka-2.3/api/elements/49",
"name": "Subject",
"resource": "elements"
}
}
],
"extended_resources": []
}