Defining http error codes when developing a python endpoint
Hi,
I was wondering if there is any way to gain control over which http error codes to show when someone calls a python function endpoint. I'm aware that a similar question has been asked in the past (see Solved: API Service endpoint to return a specific HTTP status code - Dataiku Community), but so far there doesn't seem to be good way of defining (custom) http status codes, at least not that I'm aware of.
My current workaround involves sending separate keys called 'http_status_code' and 'http_status_message' in which I can define things myself. However, I would prefer that the calling party receives a custom 4xx code instead of a 200 code and looking up the actual status in the mentioned keys.
Is there any way to do this in Dataiku?
Thanks.
Answers
-
Sarina Dataiker, Dataiku DSS Core Designer, Dataiku DSS Adv Designer, Registered Posts: 317 Dataiker
Hi @Jus
,
Indeed there is not a way to set custom HTTP response codes for API endpoints. Your approach of sending the information via returned keys is indeed the best option. You can post this on the Product Ideas board as well.
Thanks!
Sarina