Assistance Required for “CannotGetPortalError” in Senaite API

Dear Senaite Community,

I hope this message finds you well.

I am currently encountering an issue with the Senaite JSON API where I am unable to retrieve the portal object. Specifically, when I attempt to interact with the API, I receive the following error message:

json

{
  "_runtime": 0.000879043069458007,
  "message": "Unable to get the portal object. More info on http://docs.plone.org/develop/plone.api/docs/api/exceptions.html#plone.api.exc.CannotGetPortalError",
  "success": false
}

I have followed the documentation and attempted to debug the instance using ./bin/instance -O Plone debug, but I have been unable to resolve the issue. Here are a few more details about my environment:

  • Senaite Version: 2.6.0 (running in Docker)
  • Plone: Installed within the Senaite instance
  • Accessing API URL: http://------/@@API/senaite/v1/client

I have confirmed that the API is active, and other basic routes like the version check are working correctly. However, whenever I try to access specific portal data like /client or /analysisrequest, I encounter this “CannotGetPortalError.”

I’ve made sure to check for user permissions, and I also tried using the debug shell in Zope but was unable to get the correct portal object using the methods I found online.

Could someone kindly guide me on what steps I should take to resolve this issue? Any assistance or advice would be greatly appreciated.

Thank you in advance for your time and help.

Hi @ErastusM,
did you access the API URL on top of the SENAITE site?
E.g. …/senaite/@@API/senaite/v1/client?

Good day @ramonski, I solved the issue.

Thank you for the response.

Can you please share what you did to resolve this?

Hello,
You can try accessing it at:

ip/senaite([your_instance_name])/@@API/senaite/v1

Hope this resolves your issue.

Yes that works thank you very much. One last thing if you could help me out, im trying to create a client with this : curl -u francois:12345 \ -X POST http://localhost:8080/senaite/@@API/senaite/v1/clientfolder/200fc376d6ed4069a0715847c411b3a5 \ -H "Content-Type: application/json" \ -d '{ "portal_type": "Client", "id": "client-002", "title": "Farm Fresh Foods", "ClientID": "FARM002", "EmailAddress": "contact@farmfresh.com", "Phone": "+123456789", "ClientContact": "Anna Green" }'

Blockquote
{“_runtime”: 0.0018270015716552734, “message”: “API has no member named ‘None_items’”, “success”: false}zope@SenaiteVM:~$

Just an update! I was able to figure it out. Thanks for pointing me in the right direction @ErastusM

Just for future reference if anyone needs this,
curl -u francois:12345
-X POST http://localhost:8080/senaite/@@API/senaite/v1/create
-H “Content-Type: application/json”
-d ‘{
“portal_type”: “Client”,
“id”: “green-pastures”,
“title”: “Green Pastures Dairy”,
“ClientID”: “GPD001”,
“EmailAddress”: “info@greenpastures.co.za”,
“Phone”: “+27123456789”,
“ClientContact”: “Lerato M.”,
“Address”: “123 Cow Road, Mooiplaas”,
“parent_path”: “/senaite/clients”
}’