Rest Api Flashcards
What is a Rest Api
A REST API is a way for two computer systems to communicate using the HTTP technologies found in web browsers and servers. Rest Api is stateless and uses Crud to handle what to do with the resources given. Crud is Create which is a post request, Read which is a get request, Update which is a put or patch request and Delete which is a delete request. Once the client sends over the request there is typically an http response code sent back, most commonly a code of 200 for successful and 500 for an error.
How are Rest Apis stateless
Stateful apps store client data on there own servers. Rest architecture requires that the clients state is not stored on the server. Each http request from the client should contain all the information that is needed for that particular http method.
Explain the http methods
Crud: Create, Read, Update, Delete. The Get method fetches a resource from the server, Post requests for a resource to be created on the server, Put requests for a resource to be updated, Delete requests for a resource to be deleted from the server.
Explain the Http status codes
Restful web services use http status codes in server responses. The most common http status codes are 200 which represent a successful request and response. The 400 codes represent a client side error. The 500 codes represent a server side error.
What is a Uri
Uri is a Uniform Resource Identifier it identifies every resource in the Rest architecture. There are 2 types, Urn which identifies a resource through a unique and persistent name and a Url which is your typical web address which is usually used when designing web apis.
What are best practices in making the URI for restful web services
Uris should be mostly standardized when developing a restful web service. Some best practices are: Develop them with the understanding that forward slashes indicate hierarchy, use plural nouns for branches, use hyphens for multiple words, use lowercase and refrain from using file extensions.
You have your domain/server url first then your resource and then the values, ids or other params.
GET /customers/{id}
what is the difference between soap and rest api
SOAP uses XML for its message format, and it’s protocol-specific, whereas REST can use JSON, XML, or other formats and is protocol agnostic (though HTTP is common).
Difference between authentication and authorization.
Authentication verifies the identity of a user, while authorization determines what actions or resources the authenticated user is allowed to access.
What is OAuth?
OAuth allows third-party services to exchange user credentials for access tokens.
Explain the purpose of API endpoints.
API endpoints refer to the specific URL where an API can be accessed to perform a specific operation. Each endpoint is associated with a particular HTTP method and a particular set of functionalities.
What are API rate limits, and why are they used?
API rate limits restrict the number of API calls a user or system can make in a specified time frame. They’re used to prevent abuse, control resource usage, and ensure fair access.
Why are API keys used, and how do they work?
API keys are unique identifiers used to authenticate the source of API calls. They’re sent along with the request, and the server uses them to identify and validate the caller.
What is the purpose of API documentation?
API documentation provides a detailed description of how to use the API, the endpoints available, request-response formats, authentication methods, and examples. It’s essential for developers who want to integrate or work with the API.