Omeka-s "Failed loading resource template from API"

I just installed Omeka-s, and after creating a few new items and a new template, the template would no longer load when creating a new item. I received the message in the console, “Failed loading resource template from API”.

When I request the template from the API, this is what I get in return.

PHP version: 7.4.20{"@context":"http:\/\/localhost\/omekasold\/api-context","@id":"http:\/\/localhost\/omekasold\/api\/resource_templates\/1","@type":"o:ResourceTemplate","o:id":1,"o:label":"Base Resource","o:owner":null,"o:resource_class":null,"o:title_property":null,"o:description_property":null,"o:resource_template_property":[{"o:property":{"@id":"http:\/\/localhost\/omekasold\/api\/properties\/1","o:id":1},"o:alternate_label":null,"o:alternate_comment":null,"o:data_type":[],"o:is_required":false,"o:is_private":false},{"o:property":{"@id":"http:\/\/localhost\/omekasold\/api\/properties\/15","o:id":15},"o:alternate_label":null,"o:alternate_comment":null,"o:data_type":[],"o:is_required":false,"o:is_private":false},{"o:property":{"@id":"http:\/\/localhost\/omekasold\/api\/properties\/8","o:id":8},"o:alternate_label":null,"o:alternate_comment":null,"o:data_type":[],"o:is_required":false,"o:is_private":false},{"o:property":{"@id":"http:\/\/localhost\/omekasold\/api\/properties\/2","o:id":2},"o:alternate_label":null,"o:alternate_comment":null,"o:data_type":[],"o:is_required":false,"o:is_private":false},{"o:property":{"@id":"http:\/\/localhost\/omekasold\/api\/properties\/7","o:id":7},"o:alternate_label":null,"o:alternate_comment":null,"o:data_type":[],"o:is_required":false,"o:is_private":false},{"o:property":{"@id":"http:\/\/localhost\/omekasold\/api\/properties\/4","o:id":4},"o:alternate_label":null,"o:alternate_comment":null,"o:data_type":[],"o:is_required":false,"o:is_private":false},{"o:property":{"@id":"http:\/\/localhost\/omekasold\/api\/properties\/9","o:id":9},"o:alternate_label":null,"o:alternate_comment":null,"o:data_type":[],"o:is_required":false,"o:is_private":false},{"o:property":{"@id":"http:\/\/localhost\/omekasold\/api\/properties\/12","o:id":12},"o:alternate_label":null,"o:alternate_comment":null,"o:data_type":[],"o:is_required":false,"o:is_private":false},{"o:property":{"@id":"http:\/\/localhost\/omekasold\/api\/properties\/40","o:id":40},"o:alternate_label":"Place","o:alternate_comment":null,"o:data_type":[],"o:is_required":false,"o:is_private":false},{"o:property":{"@id":"http:\/\/localhost\/omekasold\/api\/properties\/5","o:id":5},"o:alternate_label":null,"o:alternate_comment":null,"o:data_type":[],"o:is_required":false,"o:is_private":false},{"o:property":{"@id":"http:\/\/localhost\/omekasold\/api\/properties\/17","o:id":17},"o:alternate_label":null,"o:alternate_comment":null,"o:data_type":[],"o:is_required":false,"o:is_private":false},{"o:property":{"@id":"http:\/\/localhost\/omekasold\/api\/properties\/6","o:id":6},"o:alternate_label":null,"o:alternate_comment":null,"o:data_type":[],"o:is_required":false,"o:is_private":false},{"o:property":{"@id":"http:\/\/localhost\/omekasold\/api\/properties\/25","o:id":25},"o:alternate_label":null,"o:alternate_comment":null,"o:data_type":[],"o:is_required":false,"o:is_private":false},{"o:property":{"@id":"http:\/\/localhost\/omekasold\/api\/properties\/10","o:id":10},"o:alternate_label":null,"o:alternate_comment":null,"o:data_type":[],"o:is_required":false,"o:is_private":false},{"o:property":{"@id":"http:\/\/localhost\/omekasold\/api\/properties\/13","o:id":13},"o:alternate_label":null,"o:alternate_comment":null,"o:data_type":[],"o:is_required":false,"o:is_private":false},{"o:property":{"@id":"http:\/\/localhost\/omekasold\/api\/properties\/29","o:id":29},"o:alternate_label":null,"o:alternate_comment":null,"o:data_type":[],"o:is_required":false,"o:is_private":false},{"o:property":{"@id":"http:\/\/localhost\/omekasold\/api\/properties\/30","o:id":30},"o:alternate_label":null,"o:alternate_comment":null,"o:data_type":[],"o:is_required":false,"o:is_private":false},{"o:property":{"@id":"http:\/\/localhost\/omekasold\/api\/properties\/50","o:id":50},"o:alternate_label":null,"o:alternate_comment":null,"o:data_type":[],"o:is_required":false,"o:is_private":false},{"o:property":{"@id":"http:\/\/localhost\/omekasold\/api\/properties\/3","o:id":3},"o:alternate_label":null,"o:alternate_comment":null,"o:data_type":[],"o:is_required":false,"o:is_private":false},{"o:property":{"@id":"http:\/\/localhost\/omekasold\/api\/properties\/41","o:id":41},"o:alternate_label":null,"o:alternate_comment":null,"o:data_type":[],"o:is_required":false,"o:is_private":false}]}

This is the JSON of the basic example template that comes with Omeka-s. But the error is due to “PHP version: 7.4.20” being in front of the JSON object, causing it to no longer be true JSON.

Any idea how to edit this and remove the “PHP version: 7.4.20”? Every one of my templates now has that in front of the JSON.

Does every API response include that string? Go to http://localhost/omekasold/api/items/<item_id> and see. If so, I suspect that there’s some debugging code that somehow got introduced during or after installation. I doubt it’s specific to Omeka, but there is the possibility.

Every end point adds the string. I reinstalled Omekas and all well now. Thanks for the feed back @jimsafley

This topic was automatically closed 250 days after the last reply. New replies are no longer allowed.