Read from a Wikipedia Article with Polygon

The vast database of information contained within the Wikipedia API has proven to be a valuable resource for Polygon developers seeking to integrate it into their decentralized applications. This API enables smart contracts to access current information on a wide range of topics without incurring additional infrastructure or node-related costs. In this tutorial, we'll construct a contract that leverages the Wikipedia API to retrieve article summaries. By establishing a bridge between the contract and the API, we'll enable smooth and efficient access to the extensive knowledge base available on Wikipedia.
Load a Template Midpoint

Login to your Midpoint dashboard and create a new midpoint. Select the “Request an Article with Wikipedia” template. This pre-configured template midpoint has already been set up to make requests to the Wikipedia API for article summaries. All the necessary configurations have been completed, so all you need is a deployed contract that can make these requests on your behalf.
Deploy Contract

To deploy a contract with the “Use This Midpoint” page, select your desired chain and the Simple Storage Contract. This will generate a contract ready for deployment. Copy that contract into your favorite editor and deploy.


If you would like to learn more about the contents of this auto-generated contract, please refer to https://docs.midpointapi.com/midpoint-documentation/concepts/misc/the-use-this-midpoint-page for further information and details.
Publish Your Midpoint
Our midpoint is now ready to go. Hit the Publish button and our midpoint will begin listening for requests.

Make a Request
Now that our midpoint is configured and live we can send a request to it. Simply invoke the testMidpointRequest function and pass in the title of the article you want to summarize.

Head to the Requests tab to follow your request live.


Our request has been fulfilled! Here's the response transaction putting the article summary back on chain.
Conclusion
Congratulations! You have just created a smart contract that is capable of retrieving the summary of a Wikipedia article through the use of the Wikipedia API and a Midpoint! Although this contract was just a basic example, it serves as a great source of inspiration for future projects. If you develop anything interesting, be sure to share it with us by reaching out at Twitter! evelopers are leveraging the power of Midpoint to connect their contracts to numerous off-chain endpoints, including DocuSign, Google Cloud, Slack, Salesforce, Twitter, and Discord. If you are a developer seeking to integrate your smart contract with off-chain services join the conversation on Discord and check out our comprehensive documentation.
More articles

Send a Text with Twilio from a Smart Contract
In this tutorial you will build and deploy a smart contract on the Ethereum network that send text messages to a phone number using the Twilio API.

Midpoint Labs is Sponsoring ETHSanFrancisco!
We're sponsoring ETHSanFrancisco on November 4th in the Palace of Fine Arts.