Number of rows in 'credit_memo' table

Posts about the simPRO API. Help/support/how-to etc.
Forum rules
  • Check the documentation first. Before posting questions, please check the documentation to ensure it doesn't already cover what you need.
  • No spam. All automated messages, advertisements, and links to competitor websites will be deleted immediately.
  • Post in relevant sub-forums only. Messages posted in the wrong topic area will be removed and placed in the correct sub-forum by moderators.
  • Respect other users. No flaming or abusing fellow forum members. Users who continue to post inflammatory, abusive comments will be deleted from the forum after two warnings are issued by moderators.
  • Harassment. No threats or harassment of other users will be tolerated. Any instance of threatening or harassing behavior is grounds for deletion from the forums.
  • Adult content. No profanity or pornography is allowed. Posts containing adult material will be deleted.
  • Bandwidth. All images and signatures must be 500 x 500 pixels or smaller. Posts containing over-sized images and signatures will be removed.
  • Illegal content. No re-posting of copyrighted materials or other illegal content is allowed. Any posts containing illegal content or copyrighted materials will be deleted.
Post Reply
gautam_syncezy
Posts: 12
Joined: Tue Nov 29, 2022 3:59 pm

Number of rows in 'credit_memo' table

Post by gautam_syncezy » Mon Aug 25, 2025 11:50 am

Hi everyone,

I get 940 number of rows in 'credit_memo' table for a client in the database but when I check the front end Simpro I am able to see 4000+ records under 'Credit'. Can anybody guide what could be a possible reason behind this difference?
mlt
Posts: 4
Joined: Tue Aug 26, 2025 10:56 am

Re: Number of rows in 'credit_memo' table

Post by mlt » Tue Aug 26, 2025 1:24 pm

Hi Gautam,

This is a very common issue when first working with the Simpro API, and you're on the right track. The discrepancy you're seeing is due to API pagination.

By default, most Simpro API endpoints will only return a set number of records per request (usually 250, but it can vary). To retrieve all 4000+ records, you need to make repeated calls to the API, incrementing the page parameter each time until you receive an empty response.

Here's a simple pseudo-code example of how you can loop through the pages to get all the credit memos:

Code: Select all

// Pseudo-code for fetching all credit memos

all_credit_memos = []
current_page = 1
keep_fetching = true

while (keep_fetching) {
    // Construct the API URL with the current page number
    api_url = "https://{your_build}.simprosuite.com/api/v1.0/companies/0/creditNotes/?page=" + current_page
    
    // Make the GET request
    response = GET(api_url)

    if (response is not empty) {
        // Add the records from this page to your master list
        add response to all_credit_memos
        
        // Increment the page for the next loop
        current_page = current_page + 1
    } else {
        // The response was empty, indicating we've fetched all pages
        keep_fetching = false
    }
}

// At this point, the 'all_credit_memos' array will contain all 4000+ records.
// You can now check the count of this array.
By implementing a loop like this, you'll be able to pull the complete dataset that you see in the front end. This pagination logic applies to almost all list-based endpoints in the Simpro API (jobs, customers, invoices, etc.).

Hope that clears things up!
Post Reply