I need help capturing a value from a JSON HTTP response from one HTTP job to be used in a second HTTP job.
Can you please provide an example?
Autosys R12.x
Example CURL Output from HTTP job:
curl -H "Content-Type: application/json" -H "authorization:<STRING>" -X GET http://<HOSTANME>:8090/analytics/api/v1/apikeys
[ {
"key" : "<STRING_VALUE_NEEDED>",
"scope" : "EVENTS",
"client" : 100,
"description" : "autosys integration"
} ]
First JOB generates the Value returned in a JSON that is required.
/* ----------------- json_test1 ----------------- */
insert_job: json_test1 job_type: HTTP
machine: <MACHINE_NAME>
owner: <USERNAME>
permission:
date_conditions: 0
description: "Test Automic"
alarm_if_fail: 1
alarm_if_terminated: 1
invocation_type: GET
provider_url: "http://<HOSTANME>:8090/analytics/api/v1/apikeys"
j2ee_no_global_proxy_defaults: 1
compatibility: 12
retry_on_failure_details: 0
results_file_overwrite: 1
persist_output_payload: 1
results_file: "/tmp/json_test1"
persist_output_header: 0
persist_output_cookies: 0
preemptive_authentication: 0
headers: Content-Type=application/json
headers: Authorization=<STRING>
output_var: var_format="jsonpath",var_name="var1",var_type="payload",var_value="key"
Second JOB uses the Value returned from job one in the variable named var1
/* ----------------- json_test2 ----------------- */
insert_job: json_test2 job_type: HTTP
machine: <MACHINE_NAME>
owner: <USERNAME>
permission:
date_conditions: 0
condition: s(json_test1)
description: "Test Automic"
alarm_if_fail: 1
alarm_if_terminated: 1
invocation_type: GET
provider_url: "http://<HOSTANME>:8090/analytics/api/v1/apikeys"
j2ee_no_global_proxy_defaults: 1
compatibility: 12
retry_on_failure_details: 0
results_file_overwrite: 0
persist_output_payload: 0
persist_output_header: 0
persist_output_cookies: 0
preemptive_authentication: 0
headers: Content-Type=""
headers: Authorization="$$payload^json_test1@<j>key</j>"
OR
headers: Authorization="$$payload^json_test1@<v>var1</v>