How to download only new orders ?

CliffSCliffS Member
Several times a day, I log into Foxycart to download new orders.

Of course, I wish to download all new orders, and not bother with any old orders.

Before I start the "search for new orders", I know the Foxcart transaction ID for the most recently downloaded order.

Is there a way to download only orders with transaction ID's greater than a given ID?

The alternative, which I am now using, is to download all orders since the previous day, which causes lots of old orders to be downloaded and slows down everything (I need to then toss out those orders which are old).
Comments
  • fc_adamfc_adam FoxyCart Team
    @CliffS,

    Good question. We don't currently have a filter for only getting orders after a specific transaction ID like you described there. One approach you could take though - is after you've completed an export in the administration, is to hide those transactions you've just exported. Then the next time you come in - only new transactions will be visible by default. You'll still be able to view all transactions by changing the display status filter from "visible" to "both" - but by default you'll only see the visible transactions.

    Could that work for your needs?
  • CliffSCliffS Member
    Thanks Adam.

    Hiding those transactions which have been exported is clumsy for an automated api: the client needs to keep parallel status entries. Note that a transaction becomes "old" only after our client has successfully processed a transaction -- which is not necessarily when a transaction has been downloaded from the Foxy server. So the hiding of a Foxy transaction can't take place when the transaction is exported; it must be a separate message sent to Foxycart afterwards.

    Hiding transactions has an additional price: If there's loss or corruption at the client side, then it becomes a pain to rebuild the client database. (Unhide everything. Download everything & compare. Re-hide.) This means additional client software to check (and possibly rebuild) a hidden entry table.

    A nicer interface, should allow filtering by transaction ID. Transaction ID's are the one known relationship between entries in the Foxy server and entries in the client database.

    Filtering by Transaction ID has many advantages:
    - it offloads work from the Foxycart servers
    - reduces bandwidth to & from Foxycart
    - speeds up processing during busy times (no dealing with processed orders)
    - reduces computational load on the client (no need to download redundant information or carry semaphores)
    - makes the developer's work easier (simpler to get the information that's needed)

    A win for everyone.
  • fc_adamfc_adam FoxyCart Team
    @CliffS,

    Thanks for sending through your specific use case there - definitely appreciate your feedback! I'll discuss with the team if there's a quick improvement we can make with our transaction filters. Transaction ID's won't necessarily be sequential in the order that they come in for a given store, but we'll see if we can make something work.
  • CliffSCliffS Member
    Thanks Adam!

    Yes, I see that transaction ID's aren't sequential for my store - that's no problem. As far as I can tell, they monotonically increase with time.
  • CliffSCliffS Member
    HOORAY! - Custom Order Numbers - YIPPEE!

    ( how do I do a "download all orders greater than Custom Order Number 123" ? )
  • fc_adamfc_adam FoxyCart Team
    @CliffS,

    Thanks for checking in! Unfortunately we still don't have filter for fetching orders after a certain order number within the administration. I'll add a note to the ticket on our side though that you've checked in.

    I missed mentioning this earlier - but it would be possible to filter for transactions between specific transaction ID's using our Hypermedia API - but that would also require some programming to set up, rather than just being able to complete the task from the admin directly.
  • fc_adamfc_adam FoxyCart Team
    @CliffS,

    Good news - we were able to make a quick change to our administration to include a new filter for you! Specifically, filters for "Since transaction id" and "Since display id" - the latter being for custom display ID's for your store if enabled. Using this you are able to get all transactions that have occurred for your store since a specific transaction/display ID.
  • CliffSCliffS Member
    Serious thanks, Adam ... Please pass my appreciation to your developers!

    -Cliff
  • CliffSCliffS Member
    Hey Adam,

    I can't find documentation describing the new api_action ... should I assume that there are underlines between the words? As follows: ??


    For a cURL request for transactions, I currently do this:

    curl.setOptionPostFields"; api_token=xyzzyxyzzy&api_action=transaction_list
    &
    transaction_date_filter_begin=" & "2017/08/15"
    &
    "&transaction_date_filter_end=" & "2017/08/16"
    ; "latin1" )


    In the future, should I do something like this:


    curl.setOptionPostFields"; api_token=xyzzyxyzzy&api_action=transaction_list
    &
    Since_Transaction_ID=" & "1319232300"
    ; "latin1" )


    [ notice the underscores within Since Transaction ID ]
  • CliffSCliffS Member
    Aaah - looks like *NO* underscores.
  • CliffSCliffS Member
    And it looks like I still need to include the "Transaction_date_filter_begin" date

    ...this is strange...
  • CliffSCliffS Member
    nope. I'm confused. Please document this new filter, with an example. *sigh*
  • fc_adamfc_adam FoxyCart Team
    edited August 16
    @CliffS,

    Sorry for missing adding those two new filters to the documentation. You'll be wanting to use since_transaction_id_filter or since_display_id_filter:

    ...&api_action=transaction_list&since_transaction_id_filter=1318398900
Sign In or Register to comment.