Included the status code check

It can help to continue based on the status code of API call.