Sunday, March 18, 2018

'API life Cycle is invalid!' Error for Oracle API CS API's

Hi, just thought to post the solution for this error, when I hit this error, searched all over internet couldn't find any specific blog describing possible cause of getting this error while invoking an API.
Let me give some background. I have created an API using Oracle API Platform Management Portal and when I tried invoking that API using google postman tool I was getting below error -
This was a silly mistake but worth highlighting. When we create API definition in API Management portal there is tab page "API Implementation" which has configuration field "API Request" where we need to define the API endpoint URL where consumer of this API will send input request. While I was declaring that portion I have given this URL "api/medrec".
There is no issue with declaring the endpoint URL in this way. However, the important point which I need to stress up on that anything after first forward slash become Private URI portion (e.g. medrec) of the API which will be passed to back-end service and if your back-end service doesn't know how to handle this private URI then we see this error while invoking the API. 
I am not saying this is one and only root cause which can produce this error message, but in my case this was the reason. There could be more scenarios which might can result same error message. If I hit with some other causes resulting this error message, I will update this blog post.
In order to fix this error, either modify the back-end service to deal with this private URI or change front-end API endpoint URL. In my case I have changed front-end endpoint URI for my API to this "apimedrec"
I hope when next time someone will search google with error message "API life cycle is Invalid" this blog may be able to fix that issue.