No header when using PaymentTransaction.transactions REST endpoint

I using the Node.js client library to fetch balance transactions like this:

let options = {
        session: session,
        limit: 10,
        payout_id: 1
    }
const response = await shopify.rest.PaymentTransaction.transactions(options);

I only get an array with all the transactions in the response. There are no headers

But when I do the same thing for payouts to get the payoutId I get the data AND header.

let options = {
        session: session,
        limit: 10,
    }
const response = await shopify.rest.Payout.all(options);

What I want to achieve is getting the Link for it to work with pagination and for that I need to have the header. How do fix this, is there a bug in the client?

Hi Riddleydiddely!

Have you looked into using the Shopify API Library for Ruby for this purpose? I believe you should be able to achieve what you’re looking for with cursor-based pagination for REST Admin API requests, see here: https://github.com/Shopify/shopify-api-ruby/blob/main/docs/usage/rest.md#pagination

Hope this helps,

No I haven’t, adding yet another language to my app adds much more complexity than I’d like, especially for only one endpoint.

The way got around this was to use the “With a plain REST client” approach rather than the “REST resources” approach as described in this doc.

let pageInfo: { [key: string]: any } = {
        session: session,
        limit: 10,
        date_min: startDate,
        date_max: endDate,
    }

new client.clients.Rest({session})
                .get

This returns headers with a link to the next page

@Liam is this bug? could you try to replicate it on your side? if so then this needs to be fixed