web_reg_save_param_json

Example: web_reg_save_param_jsonCorrelation Functions for C

Registers a request to save dynamic data in an buffer that has been formatted as Json. The data is saved to a parameter.

C Language

int web_reg_save_param_json( "ParamName=<output parameter name>", "QueryString=<json query>", ["SelectAll=<Yes|No>",] <List of Attributes>, <Search Filters>,LAST ); 

Argument Description
ParamName The name of the parameter to store the returned value. If the parameter does not exist, it is created.
QueryStringThe path of the value to save. For the syntax of the query string, see Json Path on GitHub.
SelectAllOptional: If SelectAll=Yes, all the occurrences of the match are saved in an array. See Saving Multiple Matches below.
List of Attributes For details of each attribute, see Attributes for Save Parameter Registration Functions. Attribute value strings (e.g., "Search=body") are not case-sensitive. See the Restrictions.
SEARCH FILTERS Specifies the sections of the buffer to search for the string in. See Search Filters for Save Parameter Registration Functions. See the Restrictions.
LAST A marker that indicates the end of the argument list.

Return Values

This function returns LR_PASS (0) on success, and LR_FAIL (1) on failure.

Parameterization

The values of keyword-value pairs can be parameterized. For example, "ALT={altParam}".

General Information

web_reg_save_param_json registers a request to find a Json node within the server response to the next Action Functions and save the string. This function is used when the server response is Json or converted to Json. For example, the function is used in conjunction with Data Format Extensions that output in Json format. The search does not to apply values returned as a result of calls to asynchronous or cross-step functions.

This function registers a request to retrieve dynamic information from the Json and save the information to a parameter. For correlation, enclose the parameter name in braces (e.g., "{param1}") in ensuing function calls which use the dynamic data. The request registered by web_reg_save_param_json looks for the the node specified with the QueryString argument and saves the contents of the node, if found. See also Correlating Statements.

Saving Multiple Matches

The web_reg_save_param_json function supports array type parameters. When you specify SelectAll=Yes, all the occurrences of the match are saved in an array. Each element of the array is represented by the ParamName_index. In the following example, the parameter name is A:

web_reg_save_param_json("ParamName= A", "QueryString=$..arguments.additional_context[0].name", "SelectAll=Yes", LAST );

The first match is saved as A_1, the second match is saved as A_2, and so forth. You can retrieve the total number of matches by using the following term: ParamName_count. For example, to retrieve the total number of matches saved to the parameter array, use:

TotalNumberOfMatches=atoi(lr_eval_string("{A_count}"));

web_reg_save_param_json is not recorded. You can add it manually to a script.

Restrictions

Scope = ALL does not apply to web_reg_save_param_json.

No searches are performed in data downloaded asynchronously.

If the HeaderNames filter argument is specified but the Scope is not Headers, the HeaderNames argument is ignored.

For more information on the DFES argument, see Attributes for Save Parameter Registration Functions.

For more information on the HeaderNames and Scope arguments, see Search Filters for Save Parameter Registration Functions

For more information on the RelFrameID and SelectAll arguments, see Search Filters for Save Parameter Registration Functions and RelFrameID Attribute.

Concept Link IconSee Also