Hi!
I am new to running API calls in general but I would like to use Julia to run API calls.
Here, I am trying to run the curl command from Julia using run(
):
call="https://rxn.res.ibm.com/rxn/api/api/v1/predictions/pr?projectId="*projectID
reactants=""" "C(O)1=C(O)C=C(C2=C(O)C=C([H])C([H])=C2C2=C([H])C=C([H])C=C2)C=C1O.[H].[H].[H]" """
run(`curl --data '{ "reactants" :
$reactants, "mol":"" }'
--header "Content-Type: application/json"
--header "Authorization:$API_key"
-X POST $call`)
I am trying to use “$” to refer to the variables created outside of this command. $API_key
and $call
create no problems, but when I use $reactants
instead of the string it stands for, I get an empty result from this curl command.
This is an example of this curl command from the manual for this type of API calls:
curl --data '{ "reactants" :
"C(O)1=C(O)C=C(C2=C(O)C=C([H])C([H])=C2C2=C([H])C=C([H])C=C2)C=C1O.[H].[H].[H]", "mol":"" }' --header "Content-Type: application/json"
--header "Authorization:apk-have-here-your-own-key"
-X POST https://rxn.res.ibm.com/rxn/api/api/v1/predictions/pr?projectId=5c532f56d6cb7600019ea342
Could someone suggest why do I use “$” wrong and if there is a better way?
Thank you!