[SOLVED] Get Records with Page Variables

I am trying to query our backend app which involves a Record Collection, I get a successful test through the Data tab. What I am trying to do is write the values to the page, but all I get are blank values. I have tried to lookup solutions on the forum, but I may not be looking at the right area.

Can anyone point me in the direction of how to utilize the response from the backend:

[
{
“id”: 60241,
“customer_id”: 337,
“plan_id”: 58559,
“status”: “active”,
“order_id”: 60240,
“product_id”: 58557,
“date_created”: “2022-04-13T14:32:42”,
“date_created_gmt”: “2022-04-13T18:32:42”,
“start_date”: “2022-03-31T00:00:00”,
“start_date_gmt”: “2022-03-31T04:00:00”,
“end_date”: “2023-04-30T00:00:00”,
“end_date_gmt”: “2023-04-30T04:00:00”,
“paused_date”: null,
“paused_date_gmt”: null,
“cancelled_date”: null,
“cancelled_date_gmt”: null,
“view_url”: “https://SOMEWEBSITE.com/index.php/my-account/members-area/58559/my-membership-content/”,
“profile_fields”: ,
“meta_data”: ,
“_links”: {
“self”: [
{
“href”: “https://SOMEWEBSITE.com/index.php/wp-json/wc/v3/memberships/members/60241
}
],
“collection”: [
{
“href”: “https://SOMEWEBSITE.com/index.php/wp-json/wc/v3/memberships/members
}
],
“customer”: [
{
“href”: “https://SOMEWEBSITE.com/index.php/wp-json/wc/v3/customers/337
}
],
“order”: [
{
“href”: “https://SOMEWEBSITE.com/index.php/wp-json/wc/v3/orders/60240
}
],
“product”: [
{
“href”: “https://SOMEWEBSITE.com/index.php/wp-json/wc/v3/memberships/products/58557
}
]
}
}
]

The values I am trying to grab are end_date and status.

I have created the page variables

When I try to set the paragraph to the value of the page variable it shows it is incompatible

I thought it might need to be a repeating item, but that only solved the incompatibility but the page is blank where I expect values to appear.

This is the logic I have on the page

Any help would be appreciated for this noob!

The schema of your page var is not right. It should not be a list of object but rather an object with the 2 properties you want to display.
But anyway, the use of a page var here may not the best.
Use a data variable, which will automatically set the schema for you according to the data resource you will bind it to.

Then in your page, use a text field and bind its value to the relevant field in the data variable.

1 Like

Thanks Fred! This did the trick :slight_smile:

1 Like