Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What design pattern to use for a client of API?

So I got a remote API specification which I am going to use to create a set of classes to communicate with this API in my application.

Are there any design patters I should take a look at when designing these classes which will act as the API's client?

like image 901
Richard Knop Avatar asked Nov 15 '11 14:11

Richard Knop


People also ask

What design pattern is an API?

APIs are contracts that define how applications, services, and components communicate. API design patterns provide a shared set of best practices, specifications and standards that ensure APIs are reliable and simple for other developers to use.

Which design pattern is used in REST API?

RESTful APIs should take advantage of HTTP methods, or verbs, such as GET, PUT, and POST. RESTful API Design Patterns: API design patterns provide a description or templates to solve specific, recurring API design problems that any software architects and API designers would like to adopt in their API designs.

What is client design pattern?

As a pattern, a client is an actor that initiates an interaction with a server, which is a functional, but typically passive, actor.


2 Answers

In addition to Data Transfer Object, have a look at Remote Facade which

Provides a coarse-grained facade on fine-grained objects to improve efficiency over a network.

like image 178
Gordon Avatar answered Nov 14 '22 22:11

Gordon


You'd want to start with Data Transfer Objects to send and receive data, but as more information is required for a useful answer I'll keep it to this.

like image 34
CodeCaster Avatar answered Nov 14 '22 23:11

CodeCaster