Dynamic String in URI from first GET request (HTTP requests in series). Is it possible with blackbox?

14 views
Skip to first unread message

Daniel Trüssel

unread,
Feb 18, 2020, 8:38:19 AM2/18/20
to Prometheus Users
Hi

I make a GET request:

# get default cart
curl -s -L -X GET \
  https://host.example.com/cortex/carts/examplestore/default \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json' \
  -H 'cache-control: no-cache' \
  -H 'x-ep-user-id: prefix-dynamixpostfix' \
  -H 'x-ep-user-roles: REGISTERED' \
  -H 'x-ep-user-scopes: examplestore' \
  -H 'x-ep-user-traits:
LSM-BusinessTx-ID=prefix-dynamixpostfix,LSM-Request-ID=prefix-dynamixpostfix,LOCALE=en-CH'
| jq '.self.uri'

result is this string:

"/carts/examplestore/hfrdanztgnsgiljvgm2dsljumu2tcllchfsgmljxmqydqojtgm3dkmzsgi="

I need only "hfrdanztgnsgiljvgm2dsljumu2tcllchfsgmljxmqydqojtgm3dkmzsgi="

For the next request this
"hfrdanztgnsgiljvgm2dsljumu2tcllchfsgmljxmqydqojtgm3dkmzsgi=" is in URI

# Post Cart Attributes
curl -s -o /dev/null -w '%{http_code}\n' -X POST \
https://host.example.com/cortex/cartattributes/examplestore/hfrdanztgnsgiljvgm2dsljumu2tcllchfsgmljxmqydqojtgm3dkmzsgi=
\
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json' \
  -H 'cache-control: no-cache' \
  -H 'x-ep-user-id: prefix-dynamixpostfix' \
  -H 'x-ep-user-roles: REGISTERED' \
  -H 'x-ep-user-scopes: examplestore' \
  -H 'x-ep-user-traits:
LSM-BusinessTx-ID=prefix-dynamixpostfix,LSM-Request-ID=prefix-dynamixpostfix,LOCALE=en-CH'
\
  -d '{
   "useCase": "NewContractMobile",
   "orderChannel":"selfCare",
   "customerSegment":"MIR",
   "bundleIntegrationId":"ALL",
   "LP1":""
}'

Which will get me 201.
If the string not correct I will receive: 204 NO CONTENT

also the HEADER:

  -H 'x-ep-user-id: prefix-dynamixpostfix' \

needs to have a dynamic part (like timestamp or UUID, but needs to be
the same for both requests).

How to implement that with blackbox_exporter? Or is there an other
exporter for that kind of stuff? Examples?

Please advise me

kind regards
Daniel

Reply all
Reply to author
Forward
0 new messages