AnsweredAssumed Answered

Returning 201 status code from custom REST endpoint

Question asked by Richard Coleman on Jul 27, 2018
Latest reply on Jul 27, 2018 by Richard Coleman

Hi there,

 

We are looking to integrate into a system which requires certain HTTP codes to be returned.

For example, when hitting a specific custom endpoint I've created, the other application expects a 201, as opposed to a 200 response code.

 

Now, having looked at the documentation, I can see that I can create custom exceptions, and return whichever status codes I want. However, I don't know if throwing an exception would really constitute "success" as far as Sugar is conecrned!

Is there a way to use the Sugar API framework to return a different success status code than 200? Or do I need to use more standard PHP methods?

 

Thanks in advance!

Outcomes