Hello,
I've been working on a integration with a large REST service. However I've been wondering if I'm using the right approach or if there is a faster way. I have a Customs_IS which has a REST connection thankfully setup with swagger. However I am wondering, do I just make al the created REST structures public so that i could make a Public Server Actions that call i can call from Customs_CS?
Because right now I kept the REST Structures private and created a public copy of them. However when I now try to make a Server Action I need to convert the Public structure into the Private structure which is a real pain.
I've picked up the practice of making copy public structures to use in the public server actions from another project, however those were fairly simple and easy to convert. So I am now in doubt if this is still the way to handle things.
Are there any best practices I could use here?
Greetings,
Robert
Hi Robert,
I found your question really pertinent.
I personally make the copy to promote the separation / isolation between the external web services to my core services (which is why we separate IS from CS in the first place) but I know by experience when you have complex structures you need to map the lists one by one which is indeed a pain.
I would like to hear more opinions on this matter.
Cheers,
João
Happy that I am not alone in this matter :D
Could you give me an example where the separation has paid of the conversion work?
i also experience the same approach for fulfilling this requirement. I made all the structures private to the api's and then made a replica of all the structures in calling methods module, which indeed are public in calling method module. I think this is the best way to make the modules intact with references or usages.
Hope, you get a like mind :)
Debasis Sahoo wrote:
I was already in that mindset, however when you see the structures i have to use right now you would start questioning that method again.
Hi everyone,
I know this is an old topic, but I was doing a search and I have run into this thread.
So I will just leave here my opinion.
I also create local structures at the IS level, to improve the isolation of the app, and mitigate the impact changes in external APIs will have in the consumer modules.
But I usually I try to avoid just doing a straight copy, I try to create new structures that are more normalized and optimized to the consumers modules use cases, this will reduce the number of attributes returned and the need of complex logic done by the consumers to shape the API response according to their needs.