PingAuthorize Server is now configured to accept HTTP requests beginning with the
path /meme-games/api/v1/games
and forward them to the Meme Game API. Before
proceeding, we will confirm that this configuration is working by making a request to the
Meme Game API through the PingAuthorize Server.
These tutorials use curl to make HTTP requests.
The Meme Game API provides an API to create a new game, which looks like
this:
POST /api/v1/games
{
"data": {
"type": "game",
"attributes": {
"invitees": ["friend@example.com"]
}
}
}
We configured a Gateway API Endpoint to forward any requests to
/meme-game/api/v1/games
to the Meme Game API endpoint.
Send a request using curl.
curl --insecure --location --request POST 'https://localhost:7443/meme-game/api/v1/games' \
--header 'Authorization: Bearer { "active": true, "sub": "user.99@example.com" }' \
--header 'Content-Type: application/json' \
--data-raw '{
"data": {
"type": "game",
"attributes": {
"invitees": [
"user.99@example.com"
]
}
}
}'
This example uses Bearer token authorization with a mock access token. For an explanation of this authorization, see For further consideration: The PingAuthorize API security gateway, part 1.
If the PingAuthorize Server is configured correctly, then the response
status should be
201 Created
with a response body like the
following.{
"data": {
"id": "130",
"type": "games"
},
"meta": {}
}