disable error logging on REST calls for a given consumed method / api
Question

Hi All,

I am using a REST API call from one of my modules to all others, as a means of checking if the other has implemented that API as a producer.  If not, that's fine by me, I'm only trying to make a list of espaces that support the API.

So this works, and in my consumer code, I have an all exceptions handler right after the api call, so even if some calls go wrong (404), my code still continues to the next espace, so all fine.

There is one annoying thing, each 404 REST call gets logged as an error in Service Center.  Is there a way to tell the platform that for a given api call, it shouldn't log any errors.  

For exception handlers, there is the option to log or not log

I can't find a similar option for a REST API call.  Is my only recourse to mess with the OnAfterResponse, or is even this too late and has the platform already logged the 404 by then ?

The closest thing I can find is the logging level in service center, but unfortunately there is no level 'None'.

I have found an earlier post where it explains you can disable all non-error logging, I'm doing that, but it still leaves all the errors being logged, which might be the majority of the espaces.


Alternatively, if I want to find out what espaces expose a given API, is there another way to find out (i.e. the system tables or some service center api method ) ?

Dorine

Solution

Hello @Dorine Boudry,

I am not offering a solution for the question about disabling error logging on REST api calls, but I believe if I have understood the ask correctly then an alternative solution is quite possible.

So if 3 applications named - ReactiveWebDemo, TraditionalWebDemo and CheckBoxDemo, all expose an API called 'AJ_RestApi' each, then you would like to track that?

If so, then I was able to do that as follows: 

1. I added the Extended Meta Model forge component as a depdendency to use its 'Rest_Expose' entity.
2. Added the 'Espace' entity under Systems as a dependency.
3. Created an aggregate to join 'Rest_Expose' and 'Espace' and of course filter it for the API of our interest, to get the above information

Hope this helps,

Best regards,

AJ

Hi @AJ. ,

this is exactly what I needed.  

Thanks for pointing out that Forge component, hadn't heard of it yet.

So yes, indeed, I am interested in a list of espaces that expose an api with a given name.  I'm still going to call the API to make sure it works correctly before adding it to my list, but at least, by checking with the REST_Expose entity first, I'm not trying to call an API anymore on all espaces that are completely unrelated.

Briljant answer,

Dorine

Very welcome Dorine! Glad that worked out

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.