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.

API SERVICE: How to specify in endpoint URL correct sort value for related objects

Hi support,
We have a digital documental project with Providence version 1.6.3 and we want show some data collected into his database by using the API Service.
Sorry, but reading the guide at URL http://docs.collectiveaccess.org/wiki/Web_Service_API#Getting_item-level_data and the section Types of information, note 4 Related items, at URL http://docs.collectiveaccess.org/wiki/API:Accessing_Data, ;I don't have unsterstood what to do with related objects.

I try to explaine what We need.

Doing this request:

I retrieve the data of one object (related to ca_list_items: list object_types and id cas_obj_monument), related to another object (related to ca_list_items: list object_types and id cas_obj_site):
{
  "ok":true,
  "preferred_labels":{ "it_IT":[ { "name":"Piazzale del Teatro (Sabratha)" } ] },
  "object_id":{ "value":"586" },
  "intrinsic":{
    "object_id":"586",
    "hier_object_id":"586",
    "type_id":"213",
    "idno":"Piazzale del teatro",
    ...
  },
  "type_id":{                                  (( this is an "object_types" which id value is "cas_obj_monument" ))
    "value":"213",
    "display_text":{ "it_IT":"Monumento Archeologico" }
  },
  ...
  "related":{
    "ca_objects":[
      {
        "item_type_id":"209",          (( this is an "object_types" which id value is "cas_obj_site" ))
        "object_id":"21",
        "relationship_type_id":"127",
        "idno":"Sabratha",
        "idno_sort":"Sabratha    ",
        "relation_id":"2038",
        "name":"Sabratha",
        "locale_id":"11",
        "row_id":"586",
        "rank":"2038",
        "labels":{ "11":"Sabratha" },
        "_key":"relation_id",
        "direction":"ltor",
        "relationship_typename":"is related to",
        "relationship_type_code":"related",
        "label":"Sabratha",
        "representations":[
        ]
      },
      ...
     ]
   }
}

With the APIs, I need to get all the objects grouped by object_types.cas_obj_monument and sorted primarily by the related grouping object_types.cas_obj_site.
How could I get this sort?

This is the request I use to get all objects grouped by object_types.cas_obj_monument (q parm in querystring):
http://<server>/service.php/find/ca_objects/?lang=it_IT&pretty=1&sort=<item_type_id cas_obj_site>;ca_object_labels.name_sort&summary=1&q=cas_obj_monument&ca_objects.is_enabled=1"

This are the bundles I add into the CURL (PHP):
CURLOPT_POSTFIELDS = "{
"bundles" : {
"access" : { "convertCodesToDisplayText" : true },
"status" : { "convertCodesToDisplayText" : true },
        "<item_type_id cas_obj_site>" : { "returnAsArray" : false },
"ca_object_labels.name" : {"returnAsArray" : true },
"ca_object_labels.name_sort" : {"returnAsArray" : true }
}
}"

With what should I replace "<item_type_id cas_obj_site>" in the request and bundles data ?
Thanks and best regards.

Sign In or Register to comment.