REST vs invoke

Hello Expert,

We found there are couple of rest services being designed and working ( in PROD ) ( at least 30+ rest services). These rest services are exposed as resource URI in the URL aliases.

But in the URL alias i found, instead of masking the actual rest url ( e.g: rest/pathOfResource ) , they have masked as invoke service
like ( /invoke/ resourcePath/_RestMethod ) ( Though i found it little strange)

Could you please share your input, can we expose a rest service as /invoke/restResource/HttpMethod.

Please comment,


Yes, you can do that its a directive just like rest or any user-defined directive, however, there are some pros and cons as stated below:

The invoke directive, like the rest directive, supports the GET, PUT, POST, and DELETE methods. For existing applications that use the invoke directive, you can update a service to call the pub.flow:getTransportInfo service and then perform a branch on /transport/http/method to execute the appropriate portions of your existing code.

However, that if you use the invoke directive instead of the rest directive, you cannot take advantage of these REST-specific features:
$resourceID pipeline variable
$path pipeline variable
_default service

Read the documentation for more insights.