GET and PUT requests - json

I have a test that I need to automate using Java:
Do a GET to check if a specific value exist in a JSON response, if exist do a PUT request with a new value
Do a GET again and search for the updated value, if found to the PUT with the original value.
Then do the GET to check if the original value exist.
Please help. Any response will be appreciated.
Thank you

Related

Get value from json in LogicApp Two/Three Levels Down

Absolute newb question here how do I get a value two levels down in the JSON data with Azure Logic Apps? The web-hook is sending in: Image of incoming JSON
I need the value for shipping/address/city...
I have been trying to run #triggerBody()?['shipping']['address']['city'] but it can't find address (obviously I am doing something wrong).
I just need some syntax to continue and your help is greatly appreciated!
One of the workaround is to use Parse_JSON connector to get the inner values of JSON. Just use the sample Schema in Use sample payload to generate schema and it fetches the inner values.
Below is the screenshot of my logic app.
Result:

Google DataStudio REGEX_EXTRACT json

I am trying to create a new field by creating a calculated field and parsing some json in Google DataStudio. However I keep getting an error saying Failed to fetch data from the underlying data set if I use REGEX_EXTRACT
formula I am using:
REGEXP_EXTRACT(json,'(?<="received_at":")(.*?)(?=")')
json string:
{"end_device_ids":{"device_id":"eui-a81758fffe0600cc","application_ids":{"application_id":"3cc54cfd-a809-42e3-89bb-4497ec67fe42"},"dev_eui":"A81758FFFE0600CC","join_eui":"0000000000000000","dev_addr":"260B1B1E"},"correlation_ids":["as:up:01FG833XJCCNBGDDNDYDRV9SRR","gs:conn:01FG16JYQBRKZC3K8HXE6CWK89","gs:up:host:01FG16JZSSC6GWA8TNY733T5GK","gs:uplink:01FG833XBKQGR83P9MTXSEQQHE","ns:uplink:01FG833XBR0NHHAM079T00ZC76","rpc:/ttn.lorawan.v3.GsNs/HandleUplink:01FG833XBR8SJYB9BMX8ZC61YY","rpc:/ttn.lorawan.v3.NsAs/HandleUplink:01FG833XJBN6BQX9HP4MYK51YR"],"received_at":"2021-09-23T01:08:02.252783252Z","uplink_message":{"session_key_id":"AXvkNZkkbAdO+pD5hVSLXg==","f_port":5,"f_cnt":1230,"frm_payload":"AQDoAjwHDjY=","decoded_payload":{"humidity":60,"temperature":23.2,"vdd":3638},"rx_metadata":[{"gateway_ids":{"gateway_id":"iot-stadslab-1","eui":"A84041FFFF1F9951"},"time":"2021-09-23T01:08:06.175212Z","timestamp":2063422380,"rssi":-125,"channel_rssi":-125,"snr":-8.2,"location":{"latitude":51.69522207692182,"longitude":5.293667793175701,"altitude":15,"source":"SOURCE_REGISTRY"},"uplink_token":"ChwKGgoOaW90LXN0YWRzbGFiLTESCKhAQf//H5lREKyn9dcHGgsI8qavigYQroDmECDgr7vshpo1","channel_index":4}],"settings":{"data_rate":{"lora":{"bandwidth":125000,"spreading_factor":10}},"data_rate_index":2,"coding_rate":"4/5","frequency":"867300000","timestamp":2063422380,"time":"2021-09-23T01:08:06.175212Z"},"received_at":"2021-09-23T01:08:02.040299926Z","consumed_airtime":"0.370688s","network_ids":{"net_id":"000013","tenant_id":"ttn","cluster_id":"ttn-eu1"}}}
My regular expression is working as expected inside Regex101. Why is my formula not working? If I try to manually add a column in google sheets using the REGEXEXTRACT(A2, "(?<=\"received_at\":\").*?(?=\")") function I am also getting an error that tells me nothing. Any solution to my problem is appreciated.
Thank you in advance.
Your regex is
=regexextract(A2,"""received_at"":"".*?""")

How to include SR related work log long description when using maximo oslc rest api?

I am doing an HTTP GET request to /maximo/oslc/os/mxsr and using the oslc.select query string parameter to choose:
*,doclinks{*},worklog{*},rel.commlog{*},rel.woactivity{*,rel.woactivity{*}}
This lets me get related data, including related worklogs, but the worklog does not include the 'description_longdescription' field.
The only way I seem to be able to get that field is if I do a separate HTTP GET to query a worklog id directly through /maxrest/rest/mbo/worklog . Then it provides the description_longdescription field.
I understand this field is stored separately through the linked longdescription table, but I was hoping to get the data through the "next gen" oslc api with one http get request.
I've tried putting in 'worklog{*,description_longdescription}', as I read somewhere that longdescription is a "non-persistent" field and must be explicitly named for inclusion, but it had no effect.
I figured out that for the /maximo/oslc/os/mxsr object in the API, I needed to reference the related MODIFYWORKLOG object through the rel.modifyworklog syntax in the oslc.select query string:
oslc.select=*,doclinks{*},rel.modifyworklog{*,description_longdescription},rel.commlog{*},rel.woactivity{*,rel.woactivity{*}}
I also had to explicitly name the non-persistent field description_longdescription for it to be included.
Ref. for the "rel." syntax: https://developer.ibm.com/static/site-id/155/maximodev/restguide/Maximo_Nextgen_REST_API.html#_querying_maximo_asset_management_by_using_the_rest_api

Get new Invoice ID when created via API using JSON

I have been using XML to create invoices but I am updating my code and switching to using JSON.
When using XML I would get a set of XML returned and part of the data was the new Invoice ID.
However, so it seems at least, when I create a new invoice via the API using JSON, I just get "http/200" (or something like that) returned and no info about what the new invoice ID is!
I need the invoice ID so I can post an attachment.
I tried adding "?summarizeErrors=false" to the end of the URL but nothing was returned unless there was an issue - kinda what it says it does :-)
Can anyone point me in the right direction?
Thanks, Jeremy
Its Ok....I resolved it. Wrong value populated in a property in the HTTP control I was using...ugh.

How to get multiple ids from JSON and pass it to next request in jmeter

please find the attached json:
"0":"10000267",
"no":"10000267",
"1":"2180100151-1-40",
"article_no":"2180100151-1-40",
"2":"550053",
"agent_code":"550053",
"3":"103896",
"customer_code":"103896",
"4":"A+",
"grade":"A+",
"5":"1336489",
"id":"1336489",
"6":"8907679958231",
"ean_code":"8907679958231",
"7":"315",
"quantity":"315",
"8":"27",
"available_quantity":"27"
},
{
"0":"10000286",
"no":"10000286",
"1":"2180100151-1-40",
"article_no":"2180100151-1-40",
"2":"550108",
"agent_code":"550108",
"3":"112230",
"customer_code":"112230",
"4":"A+",
"grade":"A+",
"5":"1432890",
"id":"1432890",
"6":"8907679958231",
"ean_code":"8907679958231",
"7":"494",
"quantity":"494",
"8":"27",
"available_quantity":"27"
Now i have extracted "id" using JSON extractor and i have to pass these multiple ids in next request . How can i do this?
For Eg: I have to pass id in next request in this format id=1432890,1336489.How can i achieve this.If any one add a code that can help to achieve this it would be great.
Call the variable by their names in the next request like ${varJson_1},${varJson_2}. So, in the next request id=${varJson_1},${varJson_2}.
If you are using json extractor to fetch multiple values then below screenshot will help you to get all the values in one variable. Then, in the next request call that variable.
As shown below, foo_All contains all the values fetched by the json in one variable. Use this in the next.
Hope this helps.