in this case how can i upadate the key pageToken value
Continuing the discussion from Updating hash key value:
Not sure if this will help with what little info you’ve provided BUT…
What is contained in the ‘variable’ pagination_parameter_for_body_update.
Is it a string or an object?
what is upbody defined as?
maybe you need to look at converting things to a string for the concatenation operation you’re performing.
HTH
dave
pagination_parameter_for_body_update = ‘[:reportRequests][0][:pageToken]’
endpoint_body = '{“reportRequests”:[{“viewId”:“185966546”,“dateRanges”:[{“endDate”:“yesterday”,“startDate”:“yesterday”}],“metrics”:[{“expression”:“ga:sessions”},{“expression”:“ga:bounces”},{“expression”:“ga:entrances”},{“expression”:“ga:pageviews”},{“expression”:“ga:uniquePageviews”},{“expression”:“ga:timeOnPage”},{“expression”:“ga:exits”}],“dimensions”:[{“name”:“ga:dateHour”},{“name”:“ga:pagePath”},{“name”:“ga:pageTitle”},{“name”:“ga:landingPagePath”},{“name”:“ga:secondPagePath”},{“name”:“ga:exitPagePath”},{“name”:“ga:previousPagePath”}],“pageToken”:“1”,“pageSize”:“100”,“samplingLevel”:“LARGE”}]}
’
here in endpoint_body i need to update the key value for pageToken key using the pagination_parameter_for_body_update.
the below things i am parameterizing
val = “my_hash”+pagination_parameter_for_body
new_val = eval(val)
endpoint_body[:reportRequests][0][:pageToken] = new_val.to_s