1

I`m following a tutorial on making external adapters for chainlink node https://www.youtube.com/watch?v=65NhO5xxSZc&list=LL&index=9&t=150s and having some trouble with the curl -x POST command. In the tutorial he is using a MacOS and the curl command is:

 curl -X POST -H "content-type:application/json" "http://localhost:8080/" --data '{ "id": 0, "data": { "coin": "ETH", "market": "USD" } }'

When running this command in CMD i get : enter image description here

I now somewhat understand that in Windows for the right syntax I have to wrap the JSON in double-quotes and add an escape character, so I did:

curl -X POST -H "content-type:application/json" "http://localhost:8080/" --data "{ \"id\": 0, \"data\": {\"from\": \"ETH\", \"to\": \"USD\"} } "

But still, Im getting an error...what would the right curl syntax look like in this example ? And i`m using VCS and runnning the two terminals in CMD should I be using PowerShell or Git Bash terminals instead ?

Im running on Win 10 X64, 20H2 10.0.19042.1110

Thx

heyooo12
  • 97
  • 1
  • 14
  • 1
    Replicate: Look at this: https://stackoverflow.com/questions/11834238/curl-post-command-line-on-windows-restful-service – Kimon M Jul 30 '21 at 08:39
  • Does this answer your question? [cURL POST command line on WINDOWS RESTful service](https://stackoverflow.com/questions/11834238/curl-post-command-line-on-windows-restful-service) – Kimon M Jul 30 '21 at 08:43
  • Can you add the code instead of images? It makes it hard to search for – Patrick Collins Aug 04 '21 at 14:44

1 Answers1

1

It was not the curl command that was the problem, but the \node_modules@chainlink\external-adapter\src\validator.js. I changed the parameters from default to constructor(callback, input, customParams) now I can curl with curl -X POST -H "Content-Type:application/json" "http://localhost:8080" --data "{ \"id\": 0, \"data\": { \"from\" : \"ETH\" , \"to\" : \"USD\" } }"

and get the ETH price feed returned.

heyooo12
  • 97
  • 1
  • 14