Hi again,

I’m struggling to understand how I can return specific HTTP Status Codes from my functions.
The documentation mentions something about ApiMethodException, suggesting I need to raise such an exception to return a specific code but I can’t find any reference to this in the code or samples.

I’m sure it’s simple enough, I just can’t work out how to do it.


Pls check the Adding HttpAPI to a Server (Delphi) article.
it contains example how to use this exception:

procedure TSampleService.AddToCache(key, value: String);
  if (_dataCache.ContainsKey(key)) then raise EROHttpApiException.Create(HTTP_409_code, HTTP_409_status);
  _dataCache.Add(key, value);

Thanks, will take a look :slight_smile: