Are you new to REST? Are you an experienced developer who needs a refresher? Use this page to help answer any questions you may have regarding RESTful APIs and how to conform to Worldpay's RESTful guidelines.
What's an API? API stands for Application Programming Interface, which is a set of communication protocols and tools (similar to a cog in a clock) that allow two systems to interact.
What is REST? REST stands for Representational State Transfer. REST is an architectural style to build web APIs that utilizes HTTP to deliver requests and responses and follows six guiding constraints.
Still need help? Check out our glossary!
Basic REST Principles
- All URLs are resource oriented and utilize HTTPS verbs such as POST and GET to distinguish between different actions.
- We use the authorization field in the HTTPS header for authorization and JSON in the body for all requests and responses.
- Standard HTTPS response codes are used for all requests and responses.
The Guiding Principles of REST
1. Client-server: Improves the portability of the UI over multiple platforms by separating the user interface concerns from the data storage concerns. Also improves scalability by simplifying server components.
2. Stateless: Keeps the session state entirely on the client , because each request from client-to-server must contain all of the necessary information to understand the request and cannot use any stored context on the server.
3. Cacheable: Requires that the data within a response be implicitly or explicitly labeled as either cacheable or non-cacheable. Cacheable responses allow clients to reuse response data in future equivalent requests.
4. Uniform Interface: REST uses the software engineering principle of generality, and the overall architecture is simplified. REST is defined by four constraints: identification of resources, manipulation of resources through representations, self-descriptive messages, and hypermedia as the engine of application state.
5. Layered System: Allows architecture to be composed in layers by constraining behavior. Each component cannot see beyond the immediate layer in which they are interacting.
6. Code on demand: Allows functionality to be extended by downloading code in the form of applets or scripts. This reduces the number of features required to be pre-implemented.
- POST Create a new object
- GET Return the value of an object
- PUT Replace an object
- DELETE Delete an object
- PATCH Partial update of an object
- HEAD Return meta information for an object
- OPTIONS Return information about the communication options available for an object.