65
Views
6
Comments
Solved
Is it in Service Action or Server Action to wrap the API Integrated from third party?
Application Type
Traditional Web, Mobile, Reactive, Service

Hi there,

I want to wrap 3rd party REST API  in an action. Should it be in service action or server action?

regard and thanks

2021-09-06 15-09-53
Dorine Boudry
Ā 
MVP
Solution

the choice of a server or service action is about how you want the coupling to be between the action being offered and all consumers.  

This is regardless of the internal workings of the action, and whether there is tight or loose coupling going on there.

For this, I would say, service action, as you don't want all your consumers to have to republish, just because there has been some internal change to the mechanics of using some external api.

@Neha Sheikh, i never heard of the 2 loosely coupled calls = bad practice rule, where did you see that ?

@ibox : see this medium article for an extensive explanation on the architecture of consuming external api's.

Dorine

2022-01-13 11-06-04
Neha Sheikh
Champion
Solution

Hi ibox,

REST API is already a loosely coupled call. if we create a service action that is again a loosely coupled call, we just do 2 loosely coupled calls one after the other. We consider this a bad practice.  Whereas Server action is tightly coupled.

Thanks,

Neha

2022-01-13 11-06-04
Neha Sheikh
Champion

Hi ibox,

Ideally, we create a service module(IS Module) to consume an API, and a wrapper server action is created to wrap that API call.

You can also refer to this post.

Thanks,

Neha


2025-01-09 14-56-57
IQ78

why server action?

thanks

2022-01-13 11-06-04
Neha Sheikh
Champion
Solution

Hi ibox,

REST API is already a loosely coupled call. if we create a service action that is again a loosely coupled call, we just do 2 loosely coupled calls one after the other. We consider this a bad practice.  Whereas Server action is tightly coupled.

Thanks,

Neha

2021-09-06 15-09-53
Dorine Boudry
Ā 
MVP
Solution

the choice of a server or service action is about how you want the coupling to be between the action being offered and all consumers.  

This is regardless of the internal workings of the action, and whether there is tight or loose coupling going on there.

For this, I would say, service action, as you don't want all your consumers to have to republish, just because there has been some internal change to the mechanics of using some external api.

@Neha Sheikh, i never heard of the 2 loosely coupled calls = bad practice rule, where did you see that ?

@ibox : see this medium article for an extensive explanation on the architecture of consuming external api's.

Dorine

2022-01-13 11-06-04
Neha Sheikh
Champion

Hi @Dorine Boudry ,

I clearly remember I read that on the Forum. it was mentioned by @Daniel Kuhlmann. and that made sense to me that is why I suggested the same to ibox here in this post. and in regular development also that's the usual practice we do to wrap API calls in server actions and not in service actions.

Thanks,

Neha

2024-07-05 14-16-55
Daniël Kuhlmann
Ā 
MVP

 Yes, indeed,  REST service integration is already a loosely coupled architecture, calling it from a service action is double the network latency, no need for that. A consumed REST service can be changed by the developer without impacting the consumers. 

If consumer are impacted by a change in the REST service, the best practise is to have a new version of the REST service, that allows each consumer at its own page to adapt the new version.

Bottom line, calling a REST service from a Service action, for me is a bad practise.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.