Skip to main content
2Charlie
Inspiring
December 11, 2017
Answered

How to access API with arguments?

  • December 11, 2017
  • 1 reply
  • 651 views

This is the API page Reports.getInactivePages (Method)  and this is how to invoke the API Invoking the API Using ColdFusion . However, I want to use the QueryRowLimit=0 to return all the records. This is what I have.

<cfset inactivePagesReport = Server.CommonSpot.api.getObject('reports')>

<cfset inactivePages = inactivePagesReport.getInactivePages(0)>

<cfset records = inactivePages.QueryRowLimit = 0 >

<cfdump var="#records#" >

This is not working. It got this error: Attempt to add a field to a locked structure of type 'Reports_GetInactivePages_Result'

    This topic has been closed for replies.
    Correct answer nic_tunney

    I haven't used Commonspot in over a decade so I am not sure how much help I can be.  It looks like on line 2 you are making the call and getting your result set, but then on line 3 you are trying to add a limiter to that result set.  According to the docs you provided, a correct call would look similar to the following:

    <cfset inactivePagesReport = Server.CommonSpot.api.getObject('reports')>

    <cfset inactivePages = inactivePagesReport.getInactivePages(userId=0, limit=0)>

    <cfdump var="#inactivePages#" >

    1 reply

    nic_tunneyCorrect answer
    Inspiring
    December 11, 2017

    I haven't used Commonspot in over a decade so I am not sure how much help I can be.  It looks like on line 2 you are making the call and getting your result set, but then on line 3 you are trying to add a limiter to that result set.  According to the docs you provided, a correct call would look similar to the following:

    <cfset inactivePagesReport = Server.CommonSpot.api.getObject('reports')>

    <cfset inactivePages = inactivePagesReport.getInactivePages(userId=0, limit=0)>

    <cfdump var="#inactivePages#" >

    2Charlie
    2CharlieAuthor
    Inspiring
    December 11, 2017

    nc_tunney, super awesome! Thank you. It works.