Home Forums Support API call with multiple parameters issue

This topic contains 5 replies, has 2 voices, and was last updated by  Hillel Coren 2 months, 3 weeks ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #17984

    brackenhill_mob
    Participant

    I cannot get the multiple params API call to work with invoices. I’m trying /api/v1/invoices?page=1&per_page=100&updated_at="long number" which returns “Invalid token”

    At the moment my quick and dirty Perl routine deliberately ignores pages but I need to process more than 15 invoices in a batch. Hence my trying to be cute and increase the number of invoices per page 😉 If this can’t be done then how do I pull multiple invoice pages? If I only use the updated_at parameter I get a batch of 15 invoices with a page count 1 of x. I can’t figure out how to pull the additional pages.

    I tried /api/v1/invoices?page=2&updated_at="long number" which again returns “Invalid token”

    Again probably being dumb (making a habit of this <g>)

    #17986

    Hillel Coren
    Keymaster

    Are you passing your token as a header?

    https://invoice-ninja.readthedocs.io/en/latest/api.html

    #17988

    brackenhill_mob
    Participant

    I believe so. The actual commands I’m trying are

    curl -X GET <my url>/api/v1/invoices?per_page=100&updated_at="<invoice long no>" -H "X-Ninja-Token: <my token>"

    and

    curl -X GET <my url>/api/v1/invoices?page=2&updated_at="<invoice long no>" -H "X-Ninja-Token: <my token>"

    If I run these commands individually (i.e /api/v1/invoices?per_page=100 or /api/v1/invoices?updated_at="<invoice long no>") they both work. They fail when I put them together as above. The one I want to get working is the first one above.

    #17989

    Hillel Coren
    Keymaster

    Try surrounding the URL with quotes

    #17991

    brackenhill_mob
    Participant

    Doh, of course! Thank you so much Hillel.

    Can you mark this as [SOLVED} as I can’t edit the first message anymore?

    Thanks again – you are a huge help to us all.

    #17993

    Hillel Coren
    Keymaster

    Glad to hear it!

    We don’t mark issue on the forum as solved, we use GitHub to track open issues.

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.

Posted in: