0

I'm wondering, Is there an option to receive data with @HTTPGET --> Make some manipulation on this data --> Create new REST request and send it to different URL - On the same Class?

Thanks

3

Yes, a @HttpPost or @HttpGet method can manipulate what it receives and then make an Http request to a different URL.

If you are asking can that different URL be handled by the same class, that depends on the @RestResource. If that pattern is fixed like this then no:

@RestResource(urlMapping='/abc/def')

but if it includes wildcards then yes, though you will need to add code to explicitly handle the various values:

@RestResource(urlMapping='/abc/*')

(There is a hacky approach for a fixed URL in that you can write one Apex method for each of the HTTP methods @HttpDelete, @HttpGet, @HttpPatch, @HttpPost, @HttpPut. But that is likely to result in a design that is quite different from the normal REST patterns.)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.