How to set Paging for Xero's Payment API? - xero-api

There doesn't seem be an option to set the page quantity in the Payment endpoint for the GET method. I need to pull the data from every line item within a payment, but cannot see a workaround. Has anyone else come up with a solution?

Hi #Casey and welcome to SO!
According to Xero (source):
You can use pagination to retrieve line item details for 100 items
(e.g. Invoices) at a time. Endpoints on the Accounting API that
currently support pagination are invoices, contacts, bank transactions
and manual journals. All major endpoints on the Payroll, Files and
Assets APIs also support paging. Use the If-Modified-Since header to
retrieve only what's changed since your previous request
However, regarding Payments, Xero's API documentation mentions how to filter or sort results but not how to paginate them, very surprising. Back in 2012 they officially confirmed this was not supported and considered it as a Feature Request.
Here's a potential solution:
I would use the 4th example in the Retrieving a filtered set of resources using the “where” parameter section here: https://developer.xero.com/documentation/api/requests-and-responses and build a pagination myself using date ranges.
Date >= DateTime(2019, 01, 01) && Date < DateTime(2019, 01, 02)
Date >= DateTime(2019, 01, 02) && Date < DateTime(2019, 01, 03)
etc.
You might also consider achieving this using the Reference variable (assuming it has numerical values) which is available in the Payments GET request too.
I hope this helps!

Related

picqer get orders from specific date

I want to know if there is a way to look back at orders from a few days ago with the picqer API.
Looking at the filters and stuff on their website it doesn't look like you can with only the API. Is there a way to do it anyway?
(i am working with vue.js and axios for my requests idk if this is relevant)
Casper from Picqer here. At this moment we do not have a filter for orders until a specific date. But if you are only looking for orders from the last few days, you could cycle trough the orders (100 items per request) until the date you want to get the orders from.
We have a suggestion noted for filtering orders in the API for a specific date. Did you notify our support team about this? Then we will notify you when that filter is available.
These are the filters we have active for the orders endpoint at this moment: https://picqer.com/en/api/orders#filters

Why is Amazon's Vendor Central API not giving POs changed on a certain date?

I'm using Amazon's Vendor Central API to find all purchase orders changed on a given date. The API runs fine, but it seems to be excluding some results. Can someone tell me what I'm missing?
Example:
I want to know of any POs changed on 12/10. I know PO 8ZTZJAZD was changed on that date because if I search for the specific PO I get a changed date of 12/10:
However, when I run the API for any POs on 12/10, I don't get any results:
Why does a record clearly changed on 12/10 not coming up when I ask for all records changed after 12/10 12 a.m. and before 12/10 11:59 p.m.?
As of March 2021, the whole vendor central/direct fulfillment API system is extremely delicate and riddled with bugs, this is unfortunately just something you'll have to deal with using business logic.

flight-offers-search and flight-cheapest-date-search - limit by number of connections and layover duration

I am testing flight-offers-search and flight-cheapest-date-search
Are there parameters available to limit by number of connections and layover duration, didn't see it in the doc.
Also, is there a functionality to fetch future prices for given period ex: get average price for 2 week trips in the next month, 3 months, 1 year?
Thank you.
Regarding your first point: In the Flight Offers Search API: As of today, the API doesn't offer a parameter to control the time of the layover you will have to check the response and do it on your side. For the number of connections, you can filter direct and non-direct flights using the parameter nonStop. Then, if you want to limit the number of stops you have to do it by filtering the response (by looking at the number of segments inside the itineraries).
Flight Cheapest Date Search has a similar parameter to control the direct and non-direct offers: nonStop.
Regarding your second point: not directly, for this, you can do it by:
Use the Flight Offers Search and do multiples searches and make an average of the prices you find
Use the Flight Cheapest Date Search to do the same (keep in mind that this API uses a pre-computed cache and has a limited number of origin-destination)

Jira birthday JQL query

I have multiple issues (people) in a Jira cloud instance and they all have a birthday field.
Now, I'ld like to run a JQL to find out if anyone have a birthday today, so I can remind everyone else. Is this possible?
I also have access to the automation for jira plugin if that helps.
Assuming that your birthday field is a valid date, try birthday_field >= startOfDay() AND birthday_field < endOfDay which should give you a result set of people/issues with birthday field value that fall today. For additional references, checkout Function Reference page.
I'm afraid this won't be easily possible.
If the field is date field (e.g. 11/Dec/1979), the birthday is probably stored including year of birth and therefore time functions (now(), startOfDay(), ...) won't work.
If the field is string field (1979-12-11), then you won't be able to compare it with today as you can get now() as a string.
One idea - if you have ScriptRunner installed, create a simple custom scripted field (e.g. Birthday Anniversary) and recalculate original birthday to birthday anniversary this year (11/Dec/2019). You will be then able to compare this field with today, e.g.:
"Birthday Anniversary" = now()
On top of that, once you are able to create such filter, you can create a custom dashboard with today's birthdays and you can subscribe to this filter and get daily overview of today's birthdays.
In my team we send notification about tickets in the following ways:
Jira filters subscription for cases where we need plain(to one person/lead/manager) notification, but without fields analysis
https://confluence.atlassian.com/jira064/receiving-search-results-via-email-720416706.html?_ga=2.134616433.1430628443.1592459825-259335427.1591590509
https://confluence.atlassian.com/jira064/receiving-search-results-via-email-720416706.html?_ga=2.134616433.1430628443.1592459825-259335427.1591590509
https://github.com/dgroup/lazylead for cases where we need automatically check ticket fields, comments, links and alert corresponding person, assignee or reporter.
Please note that i'm author of https://github.com/dgroup/lazylead app.

Get the latest events of a specific type from a specific device

Is there a way to get the latest event of a specific type from a specific device? So far I queried all events via myURL/event/events?source=<<ID>>&type=<<type>>.
Or is there a way to get a collection of events ordered by their creationTime? This could solve my problem too
In the documentation I only found parameters like dateFrom and dateTo. But what if I don't know the time range of the last event?
The syntax is: /event/events?type={type}&source={source}.
For more information on the available endpoints:
GET /platform
Answer from the support-team:
currently there is no way to revert the order of events. Besides
dateFrom and dateTo you can also use creationFrom and creationTo. This
will take the creationTime (server side timestamp when event was
created) instead of the time (that is send within the event) But the
order will still be oldest -> newest.
Best approach currently would be to use a good estimated time range
(so you don't end up with 0 events in the response) where the
dateTo/creationTo is in the future. If you add to the query params
withTotalPages=true the result will give you the total pages in the
statistics part.
Knowing the total pages you can you can do the query again but with
currentPage=XX instead of withTotalPages=true and take the last
element.
We have this functionality on measurements and audits where you can
add the parameter revert=true. I will add an improvement that we
extend this to the other APIs but at the moment you are limited to the
workaround.
You can just only set the dateFrom parameter and the pageSize to 1 like so: &pageSize=1&dateFrom=1970-01-01. As of September 2017, this returns the most recent event.