Answered

How to access get rest call results without re-issuing rest call.

I have a successful test which performs a "get rest value" call and extracts elements from that call.   The call is put into a loop and the extraction indexed with the loop variable:

Something like:

     ga[@loop_index].project

The issue I have is that the rest call has a data limit associated with it so I can limit the amount of data which comes back. So, I don't get the same data with each call and it doesn't always come back in the same order.

Is there a reasonable  way to take the results of my first "get rest value" call and go through those results without making additional real calls.   The extraction mechanisms are already in place in subject7, I just want to use the existing data package instead of having to retrieve it each time.

0
5 comments
Avatar
Joseph Hamdan

Hi William,

Would it be possible to show a sample response and specify data you want to grab? 

Showing the order of your steps would be really helpful as well. Thanks! 

Regards,
Subject7 Team

0
Comment actions Permalink
Avatar
William Smith

BTW, sometimes when I enter information here instead of submitting it the data entry box gets cleared and my response does not remain.

As mentioned, pulling out the data is no problem.  The issue is that I have to execute the "get rest value" call every time I want to pull data from the response slug.

Having said that, here is a modified example of the data:

"gA" : [ {
"xx1" : {
"xx2" : [ ]
},
"mech" : { },
"cgc" : "W",
"ac" : "ABC",
"apc" : "MM",
}, {
"xx1" : {
"xx2" : [ ]
},
"mech" : { },
"cgc" : "W",
"ac" : "XYZ",
"apc" : "II",
}, {
"xx1" : {
"xx2" : [ ]
},
"mech" : { },
"cgc" : "WT",
"ac" : "DEF",
"apc" : "NN",
}
}]

And here is a modified example of my extraction loop.

LOOP loop_index FROM 0 TO @count - 1 STEP 1
    VALUE_GET_REST CONNECTION <connection info here>  RESULT_VARIABLE mycgc STATUS_VARIABLE post_status FIELDS "gA[@loop_index].cgc"="BODY_JSON" HALT ON ERROR
    WRITE TEXT "vars read: @mycgc" OUTPUT CONSOLE HALT ON ERROR
    COMPARE @post_status EQUAL "200" AS TEXT HALT ON ERROR
    IF @mycgc EQUAL "W" AS TEXT
        SET VARIABLE w_code_count VALUE EXPRESSION "@w_code_count + 1" HALT ON ERROR
    ELSE_IF @mycgc EQUAL "WT" AS TEXT
        SET VARIABLE wt_code_count VALUE EXPRESSION "@wt_code_count + 1" HALT ON ERROR
    ELSE
        SET VARIABLE other_code_found VALUE STATIC @mycgc HALT ON ERROR
    IF_END
LOOP_END

0
Comment actions Permalink
Avatar
William Smith

Any thoughts on this?

 

0
Comment actions Permalink
Avatar
Joseph Hamdan

Hi William,

We're still looking into this, will keep you posted. Appreciate your patience.

Regards,
Subject7 Team

0
Comment actions Permalink
Avatar
Joseph Hamdan

Hi William,

Thanks for your patience. You can retrieve the entire response once using Get_REST_Value command, then parse it with JavaScript as an array and use Loop to go through the values.

A sample test case will be sent to you via email. After importing, you can find it in this path:

Home > subject7_admin > subject7_admin > subject7_admin

Regards,
Subject7 Team

0
Comment actions Permalink

Please sign in to leave a comment.