This task provides examples of basic workflows for the API Portal.
To do: Review with stakeholders and finalize
#### Anonymous requests
```
# Read requests
GET https://api.wikimedia.org/core/v1/wikipedia/en/page/Earth
User-Agent: CoolToolName/0.0 (https://example.org/CoolTool/; CoolTool@example.org) UsedBaseLibrary/0.0
# Write requests
GET https://en.wikipedia.org/w/api.php?action=query&meta=tokens
POST https://api.wikimedia.org/core/v1/wikipedia/en/page
Content-Type: application/json
{
"source": "Hello, world!",
"title": "User:<my username>/Sandbox",
"comment": "Making my first request with the Wikimedia API",
"token": "..."
}
```
#### Owner-authorized requests
```
# Call API on behalf of client owner
GET https://api.wikimedia.org/core/v1/wikipedia/en/page/Earth
Authorization: Bearer <access-token>
```
#### User-authorized requests
```
# Request authorization from user
https://meta.wikimedia.org/w/rest.php/oauth/authorize?client_id=<client id>&response_type=code
# Get access token
POST https://meta.wikimedia.org/w/rest.php/oauth/access_token?grant_type=authorization_code&code=<authorization code>&client_id=<client id>&client_secret=<client secret>
# Call API on behalf of authorized user
GET https://api.wikimedia.org/core/v1/wikipedia/en/page/Earth
Authorization: Bearer <access-token>
```
#### References
* https://www.mediawiki.org/wiki/API:Tokens
* [[https://docs.google.com/document/d/1qe3Z3rvCyO_EfDT4QzE_DCCa0C4_MNKI-5fDkdbGyFg/edit?ts=5e1e192d# | URL mappings doc]]
* https://www.mediawiki.org/wiki/OAuth/For_Developers#OAuth_2