City Weather and Examples
Last updated
Last updated
First, go to Chainlink Functions Playground - City Weather and the source code will be loaded into the playground. Alternatively, you can copy and paste the following code into a blank playground:
Copy the HTTP request https://wttr.in/${city}?format=3&m and replace city
with Sao-Paulo in a browser to see the expected result:
Back in the playground, 1. make sure the “Argument” is Sao-Paulo
then 2. click the “Run code” blue button at the bottom left and 3. the “Output” will be displayed:
Try your city or your next vacation spot!
Navigate back to your subscription on Chainlink Functions and click the "Add consumer" button on the far right:
You can have multiple consumer contracts in a single Chainlink Functions Subscription (up to 100)
Now 1. paste in your WeatherFunctions.sol
deployed address and then 2. click the “Add consumer” blue button:
MetaMask will pop-up for you to confirm the transaction:
Once the transaction is confirmed, refresh the page and you will now see your new consumer: