Use Rest API to retrieve custom schema results with Page Provider

I'm trying to retrieve document custom schema properties via a REST call. I am only able to pull basic document details. I would like to pull the custom schema fields for my document type via rest. Is this possible, and if so how can it be done?

What's returned Example:

{“entity-type”:“documents”,“isPaginable”:true,“resultsCount”:1,“pageSize”:10,“maxPageSize”:1000,“resultsCountLimit”:10000,“currentPageSize”:1,“currentPageIndex”:0,“currentPageOffset”:0,“numberOfPages”:1,“isPreviousPageAvailable”:false,“isNextPageAvailable”:false,“isLastPageAvailable”:false,“isSortable”:true,“hasError”:false,“errorMessage”:null,“totalSize”:1,“pageIndex”:0,“pageCount”:1,“entries”:[{“entity-type”:“document”,“repository”:“default”,“uid”:“cd83d8cc-58bb-4bfc-9ca3-857901da5851”,“path”:“/default-domain/workspaces/MasterData/0100311180”,“type”:“ps_ShipTo”,“state”:“project”,“parentRef”:“e1099e02-f961-457a-a543-a7b7a03a298e”,“isCheckedOut”:true,“isVersion”:false,“isProxy”:false,“changeToken”:“1-0”,“isTrashed”:false,“title”:“0100311180”,“lastModified”:“2020-02-21T17:00:31.643Z”,“facets”:[],“schemas”:[{“name”:“uid”,“prefix”:“uid”},{“name”:“common”,“prefix”:“common”},{“name”:“dublincore”,“prefix”:“dc”},{“name”:“ps_shipto”,“prefix”:“ps_shipto”}]}]}

What I'm trying to pull :

“dc:source”: null,

"dc:publisher": null,
"ps_shipto:shiptp_effstatus": "A",
"ps_shipto:shipto_customer": "0060182404",
"ps_shipto:shipto_product": "1092",
"ps_shipto:shipto_oper_unit": "5915",
"ps_shipto:shipto_bu": "80152",
"ps_shipto:shipto_department": "6200"

Page Provider table layout ShipToPageProvider.PNG

0 votes

2 answers

1194 views

ANSWER



Hello,

I am not sure if you want to know how to search by using the custom schema properties, or if you want to get those properties in the results object. Anyway, I'll explain how to do both:

1) Search by using custom schema properties:

If you have defined your Page Provider using Nuxeo Studio, then, by default, you will have a “Named Parameter” page provider. I mean, you will have something like this: https://doc.nuxeo.com/nxdoc/search-endpoints/#named-parameter-in-where-clause

So if you want to use the REST API, you can add the parameters after the “execute”. For example: GET http://NUXEO_SERVER/nuxeo/api/v1/search/pp/pp_PP_ShipTo/execute?ps_shipto_shipto_effstatus=A&ps_shipto_shipto_customer=0060182404

The name “ps_shipto_shipto_customer” is the same you can see in the Table layout changin the “:” to a low bar.

2) Retrieve custom schema properties:

In this case, you will need to add the “properties” header in your request. Check this: https://doc.nuxeo.com/nxdoc/special-http-headers/

Regards.

2 votes



As Rodri suggested, you need to add in your HTTP headers the schemas which should be returned. In your case, what matters is the properties attribute which should be set to dublincore,ps_shipto for example.

1 votes