I am making a request to get a page, then in that response, I grab the needed data and then grab the token that is also returned in the response and use it in the API to get the next page. The token to get the next page is a parameter in the data body for CURL, the parameter (token) is also URL encoded and the token value is set to a variable named "local body"
Please note when I take the token needed, filter it URL encoded, and then manually paste the encoded token into the shell script where it is needed, it works perfectly.
With that being said, this is 100% an issue with my lack of understanding for Quotes and shell script along with token processing for % signs with Keyboard Maestro.
I tried to replace the % signs with %% and that didn't work either
Here are my requirements
- the token must remain encoded here is an example of a token
&__OSVSTATE=XGAIfDCWDWQTahZXUKIimkQxsqd7Y4Wj%2B9VtGuFOcr0K6HfLEbro2c%2BNGL6EYx%2Ben4P0P9gDNcLUg2Qcmmc7Q3JJ2aaf7lJ9uRyzJ%2FSikaR24%2F%2BC5m%2FOpm5wsIXRjP2ut%2FZGVlEsh29xOR3FRKrqlZEQomO1DnPw4mYCFwWjNr8MAtphqhFiyCWhU2GxeYS4XE6aFaHSBfmIzdmphB%2FEEAdntzboTE9bbXKlftUYZTdUZO6WISO2%2FHv3VDExOu7frN7X%2Bb7D2aBWMGvYnVLXbVdUa%2Bf%2Fd9HTf4mdy6SRsBti4v9Fs5Bn2cXxR%2FRsXuIWgvJLknj3dpRnqNvkB5Pn17uQMMTllfyYrFm2gvoVZU4Cq%2FWR4O4XZt0iaupZ2kzpTyn3JbZQzGabBVLCnKzgd2bjhkHg60YS3VY5kAb47ZrJu8YxFDh%2FNyXoeUk6tAwKDd0lwNg6rke5j3LWrjWHLOfQpw%2BC6QJF7esaI8kWa1CKuC9aKxDLYsFgEEAhDcpRaiJ%2BBrVRVOc4r1vNgR0Hxux3x8xnrYknA3maHfBJMe6VCgKfjegywtYv6vCXRLK9Q4p4nWlmkCe7gmV%2Fbr%2BT9xW%2B9jN9hOkpzWCOQi --- TOKEN continues this is only so format is understood
- The Data field is as follows
--data '__EVENTTARGET=RichWidgets_wt58%24block%24wt28&__EVENTARGUMENT=&__OSVSTATE=XGAIfDCWDWQTahZXUKIimkQxsqd7Y4Wj%2B9VtGuFOcr0K6HfLEbro2c%2BNGL6EYx%2Ben4P0P9gDNcLUg2Qcmmc7Q3JJ2aaf7lJ9uRyzJ%2FSikaR24%2F%2BC5m%2FOpm5wsIXRjP2ut%2FZGVlEsh29xOR3FRKrqlZEQomO1DnPw4mYCFwWjNr8MAtphqhFiyCWhU2GxeYS4XE6aFaHSBfmIzdmphB%2FEEAdntzboTE9bbXKlftUYZTdUZO6WISO2%2FHv3VDExOu7frN7X%2Bb7D2aBWMGvYnVLXbVdUa%2Bf%2Fd9HTf4mdy6SRsBti4v9Fs5Bn2cXxR%2FRsXuIWgvJLknj3dpRnqNvkB5Pn17uQMMTllfyYrFm2gvoVZU4Cq%2FWR4O4XZt0iaupZ2kzpTyn3JbZQzGabBVLCnKzgd2bjhkHg60YS3VY5kAb47ZrJu8YxFDh%2FNyXoeUk6tAwKDd0lwNg6rke5j3LWrjWHLOfQpw%2BC6QJF7esaI8kWa1CKuC9aKxDLYsFgEEAhDcpRaiJ%2BBrVRVOc4r1vNgR0Hxux3x8xnrYknA3maHfBJMe6VCgKfjegywtYv6vCXRLK9Q4p4nWlmkCe7gmV%2Fbr%2BT9xW%2B9jN9hOkpzWCOQi&__VIEWSTATE=&__VIEWSTATEGENERATOR=8EA4AF55&wt85=&wt79=&wtStatusComboBox=999&wtStatusComboBox2=__ossli_0&wt69=__ossli_1&wtDateFrom=01-01-2022&wtDateTo=02-23-2022&wtListAppointmentTable%24ctl02%24RichWidgets_wt30%24block%24wttxtTableRecordsId=wtListAppointmentTable&wtListAppointmentTable%24ctl02%24RichWidgets_wt83%24block%24wttxtTableRecordsId=wtListAppointmentTable&wtListAppointmentTable%24ctl02%24RichWidgets_wt21%24block%24wttxtTableRecordsId=wtListAppointmentTable&wtListAppointmentTable%24ctl02%24RichWidgets_wt72%24block%24wttxtTableRecordsId=wtListAppointmentTable&wtListAppointmentTable%24ctl02%24RichWidgets_wt24%24block%24wttxtTableRecordsId=wtListAppointmentTable&wtListAppointmentTable%24ctl02%24RichWidgets_wt3%24block%24wttxtTableRecordsId=wtListAppointmentTable&__AJAX=2002%2C1498%2CRichWidgets_wt58_block_wt28%2C1463%2C1914%2C349%2C0%2C1947%2C1482%2C'
- I have tried to replace the __OSVSTATE value with the following $KMVAR quote combinations
'info&__OSVSTATE="$KMVAR_local_body"moreinfo'
syntax: open with single quote - databefore param - double quote VAR double quote - more data after
VAR - single quote to end
'info&__OSVSTATE=''"$KMVAR_local_body"''moreinfo'
syntax: open with single quote - databefore param - single quote (to end previous literal) single quote (open new literal) double quote VAR double quote single quote single quote - more data after VAR - single quote to end
'info&__OSVSTATE='"$KMVAR_local_body"'moreinfo'
syntax: single quote open - info - single, double - VAR - double, single - more info - single quote to end
I have also tried to reverse the quotes by opening and ending the data body with double quotes.. and I have tried no quotes along with setting my value in a text variable and passing it in as the entire body itself.
I hope this was not confusing, I would love to understand this quote madness. Thank you