0
I am using the json API and calling it through Javascript and using the jQuerySBM.ajax command to read and then use details returned by the Report which has been added in Composer.

http:///jsonapi/getitemsbylistingreport/{internal table reference}/{internal report reference}

Table I have worked out to be USR_MY_TABLE by selecting "My Table" within composer and looking at the Database table name and adding the Prefix.

The report reference I can not find anywhere.

Once I have that I still need to get the name for the data (JSON) parameters (POST data) to the report which I think go "F_TS_{field name}".

Can anyone elaborate on what you get in the JSON API Guide which gives;
- "reportReferenceName" = String but not how to get it.
- for the parameters it gives "f80v1=0" but how do you know the f80v1 value in the first place and will that work up the tiers?

Many thanks
Responses (1)
  • Accepted Answer

    Sunday, March 10 2019, 02:56 PM - #Permalink
    0
    Report Reference name is specified in the "Save" dialog for the report. I'm not sure if the "getitemsbylistingreport" call needs the table's DB name prefixed to the reference name. I.e. "USR_MY_TABLE.My_report_reference_name". You can see this after running the report in the GUI, then selecting "Copy URL to Clipboard / Reference Link" from the "Actions" droplist. Within the URL, the "ReportURL" param contains the "full" reference name which includes the table's DB Name. I use the report's UUID in the examples below.


    The following jQuery call uses the UUID of the report and prints the returned results to the JavaScript debug console:

    jQuerySBM.getJSON("tmtrack.dll?JSONPage&command=jsonapi&JSON_Func=getitemsbylistingreport&JSON_P1=39be7eba-6005-4075-8f73-387c4c8c96ee", function(data,str,xhr) { console.log("result=",str) ; console.log("data=",data) } )

    Note that "getJSON" will only return System fields like Issue Type, Title, Submit Date, etc.


    To get other fields you need to use the jQuery "ajax" function and pass a list of the fields you want to get back:


    var results = new Object();

    jQuerySBM.ajax("?JSONPage&command=jsonapi&JSON_Func=getitemsbylistingreport&JSON_P1=39be7eba-6005-4075-8f73-387c4c8c96ee",{
    method: "POST",
    success: function(data, str_status, jqxhr){
    results=data ; console.log(jqxhr.responseText); console.log("result=",str_status) ; console.log("data=",data);
    },
    headers: {
    alfssoauthntoken: top.ssoToken,
    "content-type": "application/json; charset=utf-8", // Sets Request Header "Content-Type: application/json; charset=UTF-8"
    "cache-control": "no-cache"
    },
    dataType: "json", // sets Request Header "Accept: application/json, text/javascript, */*; q=0.01"
    // Pass an OBJECT to "stringify" ... NOT a string!!!!!!!!!
    data: JSON.stringify({fixedFields: false, fields: [{dbname: "CHECK_RIDE_USER"},{dbname: "DATE_COMPLETED"},{dbname: "PASS_FAIL"},{dbname: "CHECK_RIDE_CONTACT"},{dbname: "ISSUEID"},]})
    });
    The reply is currently minimized Show
Your Reply

Recent Tweets