CURL KM Var with Percent Sign

Perhaps just source filename?

okay

the body has
--data single quote DATA single quote

should the variable string start and end with a single quote then? and do I have to double replace the % signs?

I think you can't combine them in a single command. I think you have to execute this in an Execute Shell Script action after you save it:

chmod o+x somefilename.sh

However once you save it and modify the permission, you MAY not have to re-execute the permission command the next time. I can't remember that detail right now. (Because it may re-use the old permission.)

Whatever works when you execute the command manually in the Terminal window is EXACTLY what you need to place into the file.

And then if you want to insert a variable into the file, it would look like this:

$KMVAR_mykmvariablename

There are a few cases where inserting variables can be tricky, but I don't see that problem here yet.

too large for environment error with I try to set a variable to the curl statement and execture the variable in the shell script

Okay. Then do it my way and insert the entire command into a file instead.

trying now, permissions are being weird

We can help with that. but I'm no uber-wizard on permissions either.

Just for reference, here's an example of something I've done. Notice that I have many quotes and special characters. Sorry about the colour, but that's how it is in my macro.

Here's an even fuller example with variables and permissions more rolled into one:

so that is saving the response of the script to a variable and writing it to a file

I am trying to launch a script file in the shell script, but I understand it was just an example to clarify for me, how do you even manually change the permission on a file to allow? Im in the get info and changed them all, it still wont allow it

I added a fuller example in the post above. Does that help better?

You can see in my example that I added variables to the file one way. There are other ways to do it, but the way that drdrang did it gave you an environment size error. So try it my way instead.

ohhh. you are saying to save the response with the page token to a file, then use the input from file function to reference the token I need which will be an exact value

how do I reference the file in the command?

I guess I didn't say that at all, because Im an idiot (and only 75% awake.) I guess that's why I posted the example, to clarify it.


this is my question

You are doing it wrong. You do not place anything in the box where you entered "things I need to do." Instead, you follow my example above, and place all the things you need to do inside a variable, and write that variable to a file. your final command will look like this:

There will be no other characters in your Execute Shell Script action other than these characters. You have to put EVERYTHING that you want to execute inside the file.

Also, you will note that my example does use an input file and does not use an output file. It sounds like you want the opposite, but that's okay. You can remove my input file parameter and use the action's output file parameter. Let me post an example.

I think that is fine, i get what you are saying now, let me try

No problem. And remember that we are doing all this to solve the complications of using quotes and escape keys in messy shell commands. Also remember that there is more than one way to dynamically adjust the command we want to execute, and I have shown you just one way. There are several variations on this technique.


Couldnt get it..

Thank you for your help! I learned something new atleast.

I have a work around with integromats, use their HTTP module to pagnate and then sending the data to MONBODB and then using KM to finish the job since I made the regex etc in KM

side bar..

Do you know how the filter

encode for regular expression

is configured?

that's really useful.. I haven't seen it anywhere else. I could prob make a separate post for that

I'm sorry we couldn't solve the problem. If you want to try again, just ask again.

I put a long-winded post here and then removed it because I realized that it wasn't what you needed. But here's the main point of what I had posted.

I would forget about trying it in bash shell at first. I would try the same code by using terminal instead.
If you get it to work in Terminal, then go to bash shell (which will require different quotes). You need to use the flag -O for curl in Terminal.

Don't worry about escaping the character '&' in your URL, which you defined as KM variable local_body.. Just use single quotes in the command for Terminal. (For shell see below.)

Have KM launch the application Terminal
Pause 0.3 seconds
Then paste the variable into Terminal with a carriage return after.
Notice that the URL or %Variable%LongTextURL% is surrounded by single quotes.

Example for multiple URL downloads. You can replace the urls with KM variables like %Variable%LongTextURL% and %Variable%LongTextURL2%

If you're using shell command, here's an example that I use that works and checks the existence of a URL. I use the variable called LongTextURL to store the URL I check on.