Does it make sense to use an api to access another api? (bematec one in case)

2

I was asked to make an API here where I work to be able to integrate some systems with nfce. For that, they hired the api one. More information here: link .

The real question is how and why should I make an API to access another API? Would not it be easier for old programs to directly access this bematec api?

It has programs made in vb, others in C # and a php.

EDIT: I'll try to apply one of these ways here. Thank you to who answered! link

    
asked by anonymous 17.08.2018 / 20:30

2 answers

1

Yes.

Creating an abstraction interface for legacy systems to access new services is something common, if not more recommendable, when:

  • The cost of changing legacy systems is very significant
  • The API you are consuming may change frequently, or it is unstable and could break your applications in some way
  • You want to implement extra functionality that would not be possible in legacy systems
    • Access Level Control
    • Obtaining metrics
    • Request caching (both to fetch data and to send data)

These are some of the reasons. Legacy systems in general aggravate the need for these interfaces (which, as @Afonso said, serve as Façade design pattern ).

There are reasons not to do this, the most obvious being less time consuming to implement the calls in your old programs:

  • Having points opposite to those quoted above
  • Legacy systems no longer accessed a standard interface before, even programming to access your internal company API would require work

This answer is more complex and this was a summary. But in doubt, do what would seem to be less work. But if someone who worked with the old system in your company says it would be less of a work to do something new (which, by what you said they would have said it was an option to choose), is a good indication of what you do not know about the technical difficulties

    
20.08.2018 / 06:40
0

It seems to me that it may be worthwhile to centrally integrate all systems. It is worth to see the Fascade drawing pattern - link

  

Facade pattern hides the complexities of the system and provides an   interface to the client using which the client can access the system.   This type of design pattern comes under structural pattern as this   pattern adds an interface to existing system to hide its complexities.

     

This pattern involves a single class which provides simplified methods   required by client and delegates calls to methods of existing system   classes.

    
17.08.2018 / 20:33