In this example, customer attributes are under top field, "customers". What would be the easiest way to create this data structure?
I know basic knowledge how to create a Service REST, but my approach is, I have used Obj-Browse after Page-New in the Service activity and returned that page in JSON format. This approach created a JSON that holds pxResults instead of customers. Also, there are many more unnecessary out-of-the-box property data like pxCreateDateTime are also included as well. So this approach doesn't work well.
What would be easiest and simplest approach? Which class should I create a Service REST rule at? Should I create a page list property for "customers" somewhere? If so, where?
Brief design description is very helpful.
***Edited by Moderator Marissa to update Platform Capability tags****
If I understood correctly, then you have to simply follow the below steps:
First, Create a page structure as per your requirement on the clipboard in your service activity using Data transform.
Example: customers (page) ->
Once you add all required fields on the clipboard (response structure) in the Rest Service Response tab and then select Map From : JSON and pass clipboard page in Map From Key. It will convert the clipboard page to the JSON structure.
Thanks. I understand the response part - if I select JSON for "Map from" and specify the page list property (customers) for "Map from key", Pega automatically converts the clipboard into JSON structure.
Now, where exactly should I create this page list properties? When I created a Service REST, I specified the customer class (ex. MyOrg-MyApp-Data-Customer) for Resource. Should I create another page list that points to the same class? I rather want the resource class to consist of its resource attributes but what is the most standard practice?