API Call to find Client Order Number

Hi All,

I am working on Senaite API to send the request based on Client Order Number.
I am using the following get method URL to pull the details for a particular Client Order Number.


The above URL returns all the available Analysis Request in the system. But, I want to get only one Analysis Request where my Client Order Number is linked.

Anybody have any idea? how can we fix this?

Thank You


First, note that objects from type “AnalysisRequest” are stored in a catalog other than “bika_setup_catalog”. You can check the catalogs a given portal type is stored by using the “catalogs” resource: Catalog resource at senaite.jsonapi documentation

If you use the catalogs resource, you’ll see that the main catalog where objects from type “AnalysisRequest” are stored is called “bika_catalog_analysisrequest_listing”. Again, if you inspect the indexes (for searching and sorting) of this catalog, you’ll find there is no index available for ClientOrderNumber. There are other indexes available though, like getClientSampleID. Therefore, you cannot do direct searches by “ClientOrderNumber”. However, if there is no choice and you need to do searches against this field, you can either

a) add an index (with name getClientOrderNumber and type FieldIndex) through ZMI to this catalog or
b) create a new catalog with your own indexes and metadata columns.

Remember that on both cases you’ll need to force the reindex the index via ZMI afterwards. If you follow the strategy (a), you will then be able to retrieve all the objects with a request like follows:


Also, please note “complete=true” forces the system to wake-up the objects found. Better to use “complete=true” when strictly necessary only.

1 Like

Hi Jordi,

Thank you for your reply. Its really helpful. I understand ClientOrderNumber is not in index. But when I try to use getClientSampleID, I get the response but it returns all the Analyst Request available in the system.


I expect, the API should return only the ID for the related Sample Id, but instead it displays everything.

Moreover, as per the documentation if I search as follows it should display information about the catalogs registered in the system, as well as the indexes and metadata fields (schema) they contain:

But instead it displays as follows
“_runtime”: 0.0028390884399414062,
“message”: “Not Found”,
“success”: false

Is there any problem in my environment or Do you have any idea? It would be really helpful if you shed light on this.
Thank You


Check you are using senaite.jsonapi v1.2.3

Hi Jordi.
No. I am using version 1.2.2.

Hi Jordi,

Thank you for your help.

I have updated the version to 1.2.3. The search functionality is working fine now. I created a custom index and able to fetch the records. Now, I am trying to create a Sample via API.

“Contact”: “2f44291246344d37b9144a5e6b087281”,
“SampleType”: “880-PCSSB”,
“DateSampled”: “2021-07-26”

But, I am getting the below error message
“_runtime”: 0.04502296447753906,
“message”: “‘NoneType’ object has no attribute ‘getPrefix’”,
“success”: false

Do you have any idea to fix this? Thank you for your help.

Prabu M

Just take a look at the documentation (CRUD — senaite.jsonapi 1.2.5 documentation). Even the doctest clearly answers your question: Doctests — senaite.jsonapi 1.2.5 documentation. Note that the Sample Type must exist previously and you need to pass its UID instead of the ID/Name whatever.

Thank you for your input Jordi. I am am able to create the samples via API. But, the sample id becomes 33 chars. I have raised this issue as a separate question in the forum. Thank you.