Rest Applescript+;休息

Rest Applescript+;休息,rest,applescript,Rest,Applescript,AppleScript有与RESTAPI交互的方式吗 我意识到我可以 do shell script curl 我会用卷曲 do shell script "#curl script here" 如果您需要帮助来获得我推荐的正确的curl语句,那么它确实可以帮助我生成正确的代码。但请记住,如果您有以下选项:“将转义字符放在前面:\” 例如,如果我想向 https://api.widerstandsberechner.ch/api.php?firstcolor=red&secondco

AppleScript有与RESTAPI交互的方式吗

我意识到我可以

do shell script curl
我会用卷曲

do shell script "#curl script here"
如果您需要帮助来获得我推荐的正确的curl语句,那么它确实可以帮助我生成正确的代码。但请记住,如果您有以下选项:
将转义字符放在前面:
\”

例如,如果我想向

https://api.widerstandsberechner.ch/api.php?firstcolor=red&secondcolor=orange&thirdcolor=yellow&fourthcolor=silver&hasFiveRings=0&resultInText=0
AppleScript将如下所示:

do shell script "curl -X POST -H \"Cache-Control: no-cache\" \"https://api.widerstandsberechner.ch/api.php?firstcolor=red&secondcolor=orange&thirdcolor=yellow&fourthcolor=silver&hasFiveRings=0&resultInText=0\""
当然,您可以轻松地将结果指定为值:

set res to do shell script "curl -X POST -H \"Cache-Control: no-cache\" \"https://api.widerstandsberechner.ch/api.php?firstcolor=red&secondcolor=orange&thirdcolor=yellow&fourthcolor=silver&hasFiveRings=0&resultInText=0\""

希望这有帮助

我认为使用
curl
是一种方法。你是说这个吗?可能重复的