Using Parameters


We’ve seen that we can send data to the API server via the header and body of a fetch request.  We’ve also seen that we can appended query strings to URLs to send data to API servers.  We can also insert parameters in URLs.

A parameter is a string that appears between two forward slashes (/).  For example, consider the following endpoint that allows a user to send a private text message to another user.

This endpoint requires a user id after /message/.  For example, if 67a7f083e9bea3f91b5e31b5 is a valid user id then the following string would be a valid URL for this endpoint.

https://hap-app-api.azurewebsites.net/messages/67a7f083e9bea3f91b5e31b5

Notice that although the documentation denotes the parameter as :userId we do not include a : before the user id.