Reply to previous thread (can't reply in thread for some reason)

I figured out the issue with my previous post, but I cannot reply to update the thread. It would be very helpful if we could reply to our posts. Here's the reply I would have written:

FYI the issue was that I had split transactions and those aren't returned by the API when requesting for transactions under a category (/budgets/{budget_id}/categories/{category_id}/transactions). 

My use case is I have a reimbursements category and I want to create an app that displays all the transactions in the reimbursements category. These reimbursements are almost always under a split transaction (e.g., shared a meal with the person). I was hoping to make a request to get the list of transactions under the reimbursements category.

It seems like you need to make a request for each transaction in order to get splits information (transaction detail request). I don't think this is going to work for my use case. I'm quickly going to run out of request quota, since I have a lot of these transactions. I think I'd also have to check every split transaction including ones that aren't from the category I care about.

For my use case, it would be very convenient to be able to get a list of transactions, including split transactions, where the transaction or one of its splits contains a certain category. 

Thanks!

Alan

11replies Oldest first
  • Oldest first
  • Newest first
  • Active threads
  • Popular
  • Hey Alan ( Turquoise Jackal ) - thanks for letting me know about that! I'll make sure to pass it along. Checking each transaction individually for splits does sound pretty inefficient. 

    I'm not sure exactly why you wouldn't be able to reply to your previous post - I'm going to do some digging. Are you able to reply to me here? 

    Angela

    Reply Like
  • Alan, thanks for the feedback!  We intentionally only respond with the sub-transactions for a transaction on the /budgets/{budget_id}/transactions/{transaction_id} endpoint to avoid a performance bottleneck in the API.  But, since the categories/{category_id}/transactions (and accounts/{account_id}/transactions) endpoints are constrained, it might work for us to include sub-transactions here as well.  Would that work for your use-case?

    Reply Like
  • Looks like replies are working !

    Hi Brady. Thanks for your response. Adding sub transactions to /categories/{category_id}/transactions would address my use case. If the overhead was large, perhaps they could only be returned if a query parameter were provided?

    Reply Like
  • Alan - I was able to make a change that should have minimal performance impact so that these endpoints will now include the subtransactions array.  It's slated for release tomorrow!

    Reply Like
  • Terrific! Thanks for making the fix so quickly. Will try to test it out soon after the release. 

    Reply Like
    • Turquoise Jackal The change has been released to production.  Also, the JavaScript client (if you use it) has been updated accordingly.

      Reply Like
    • Brady at YNAB thanks! I verified I'm getting subtransactions.

      It would be more efficient for me if it were possible to have the categories request include transactions where:

      transaction.category_id = provided_category_id
          || transaction.subtransactions.contains(
              subtransaction -> subtransaction.category_id == provided_category_id)
      
      

      ...but if you don't think it makes sense to do this, I can still do what I need to do by requesting for all transactions. 

      Reply Like
    • Turquoise Jackal I'll put that on our list for consideration.  I do understand the use case and will give some thought as to including filtering of the sub-transactions by category.  I am glad you are able to get what you need for now though!

      Reply Like
  • I'm not seeing the sub-transactions for a category when I request that category's transactions from the API. That seems like a flaw in the API since there's no way to find these sub-transactions other than getting the full transaction list and traversing each transaction and all sub-transactions manually.

    I would have expected that the /budgets/{budget_id}/categories/{category_id}/transactions endpoint would return just the sub-transaction part of any matching transactions, so that it's possible to quickly calculate the current spending within a category.

    I can't imagine this would be too hard to do, since this information is already available via the web UI, see the screenshot below. The important part to note is that the amounts shown in this screenshot are only the split amounts in that category, which is what I want to see when I click that activity number.

    Reply Like
  • Aaron Parecki Thanks for bringing this up.  This is something we intend to improve and I am talking with the team about it now. There are some options for how to structure the response in this scenario so we want to make sure we provide the data in a convenient structure.

    Reply Like
  • Update: This is in the works!

    Reply Like
Like Follow
  • Status Answered
  • 1 yr agoLast active
  • 11Replies
  • 258Views
  • 4 Following