Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the CollectiveAccess support forum! Here the developers and community answer questions related to use of the software. Please include the following information in every new issue posted here:

  1. Version of the software that is used, along with browser and version

  2. If the issue pertains to Providence, Pawtucket or both

  3. What steps you’ve taken to try to resolve the issue

  4. Screenshots demonstrating the issue

  5. The relevant sections of your installation profile or configuration including the codes and settings defined for your local elements.


If your question pertains to data import or export, please also include:

  1. Data sample

  2. Your mapping


Answers may be delayed for posts that do not include sufficient information.

Web Service API

edited November 29 in Troubleshooting
I am trying to write a script that is going to let me make similar changes to many records at once. For now I am trying to make a simple call to change the title of an object. The call I have been trying to use is:

curl -XPUT 'http://catest.hsplan.org/ca/service.php/item/ca_objects/id/4711?pretty=1&authToken=<authtoken>' -d '{
"preferred_labels":{
"en_US":[
{
"name":"An unnamed reveler from the 1924 Mummers Parade TEST"
}
]
}
}'



This code has been returning the error:
"ok":false,
"errors":[
"Name must be at least 1 characters"
]



Any help will be appreciated.


EDIT:

If I use a get call to the object I am trying to edit here is the output: (output is long so only copied the name)
curl -XGET 'http://catest.hsplan.org/ca/service.php/item/ca_objects/id/4711?pretty=1&authToken=<authtoken>'

"ok":true,
"preferred_labels":{
"en_US":[
{
"name":"An unnamed reveler from the 1924 Mummers Parade"
}
]
},
...

Comments

  • Hi,

    Try setting the label hash directly on "preferred_labels" The locale – if needed – goes in the hash, not separately.  Something like this:

    {"preferred_labels":{ "name":"An unnamed reveler from the 1924 Mummers Parade TEST" }}
  • edited December 5
    <b>Warning</b>:  Illegal string offset 'locale' in <b>/var/www/providence-1.7.5/app/lib/ca/Service/ItemService.php</b> on line <b>908</b><br />
    <br />
    <b>Warning</b>:  Illegal string offset 'locale' in <b>/var/www/providence-1.7.5/app/lib/ca/Service/ItemService.php</b> on line <b>909</b><br />
    <br />
    <b>Fatal error</b>:  Cannot unset string offsets in <b>/var/www/providence-1.7.5/app/lib/ca/Service/ItemService.php</b> on line <b>910</b><br />

    Thats the errors I get when I try the call '{"preferred_labels":{"name":"An unnamed reveler from the 1924 Mummers Parade TEST"}}'
  • edited December 5
    Trying '{"en_US":[{"preferred_labels":{"name":"An unnamed reveler from the 1924 Mummers Parade TEST"}}]}' seems to have worked, except no change is visible on the website.

    It returns
    {
    "ok":true,
    "object_id":"4711"
    }
  • That's the correct syntax. Which website are you referring to? The change should be visible in the back-end (Providence) editor.
  • The change is not visible in Pawtucket or Providence.
    I used the Providence address in the URL for the curl statement.
  • No idea then... check the change log. If there's nothing there then the update is failing silently for some reason. We'd have to trace it in the code to know why. It's not a problem that has come up before.
Sign In or Register to comment.