Curl command in a Groovy-script fails: "Could not interpret \"projects as an identifier in \"projects."

I try to implement a curl command in a groovy script. The goal off my command is to create a task in Asana. This is my groovy-script, I have 3 questions about this script:

  1. Is it possible that groovy changes the command at runtime? (is it possible that groovy has some problems with the data-urlencode parameter)
  2. Has this something to do with the version of curl? (version 7.64.0) (works perfectly when I run it seperatly)
  3. Can someone give me a (brief) explanation what is happening on line 20-21 (Because if I change these lines that produces a kind of strange exceptions)

The command works perfectly in a command prompt but fails in the groovy-script.

1 def opsAlert = opsgenie.getAlert(alertId: “${alert.alertId}”);
2 //logger.warn(“${opsAlert}”); //DEBUG
3 if(opsAlert.isEmpty()){
4 throw new Exception(“Failed to get the alert details, opsAlert is null!”);
5 }
7 if(opsAlert.source.equals(“jstaelens”)){
8 def projects = “”;
9 def name = opsAlert.details.sensorId;
10 def notes = opsAlert.message;
11 def authorizationToken = “Bearer ”;
13 def command = “curl “;
14 command += “-H "Authorization: ${authorizationToken}" “;
15 command += “–data-urlencode "projects=${projects}" “;
16 command += “–data-urlencode "notes=${notes}" “;
17 command += “–data-urlencode "name=${name}"”;
18 logger.warn(”${command}”); //DEBUG
20 def commandResult = “${command}”.execute();
21 commandResult.waitFor();
22 logger.warn(”${commandResult}”);
24 //def output1 = commandResult.text;
25 def output2 = commandResult.err.text;
26 //logger.warn(”${output1}”); //DEBUG
27 logger.warn(”${output2}”); //DEBUG
28 return;
29 } else {
30 throw new Exception(“S(s)ource was not jstaelens!”)
31 }

After a lot off testing, I get the flowing error:
"Could not interpret "projects as an identifier in “projects.”
Is there a way off properly escaping the --data-urlencode parameter?
My command works when I run it outside the script.
curl -v -H "Authorization: Bearer " --data-urlencode “projects=” --data-urlencode “notes=message” --data-urlencode “name=Alias_2”