Quantcast
Channel: LoadRunner Practitioners Forum topics
Viewing all articles
Browse latest Browse all 3978

How to add variable to JSON file for REST API script

$
0
0

Hi,

I am using LR 12.02 and was wondering if anyone knew how to call a variable into a JSON file (request body) that I use as an Extra File in my Web protocol script (here the file is called CheckoutIndivCust.json).

 

        web_custom_request("web_custom_request",
        "URL=https://connect-qa3.paciolan.corp/pdi/v1/cart/{CartID}/checkout?policyCode=EXPERIENCE",
        "Method=POST",
        "TargetFrame=",
        "Resource=0",
        "EncType=application/json", 
        "Mode=HTTP",
        "BodyFilePath=CheckoutIndivCust.json",
        "Referer=",
        "Body=",
        LAST);

 

Here is a snippet of my JSON script:

        "amount": 86.00
    }]
}

 

Instead of hardcoding the value of 86.00 I want to call a variable that I created called 'Balance'

    web_reg_save_param_ex(
        "ParamName=Balance",
        "LB=\"balance\":",
        "RB=,\"",
        "Ordinal=1",
        SEARCH_FILTERS,
        LAST);

 


Viewing all articles
Browse latest Browse all 3978

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>