Conversation With API Builders

Success key not needed in response

I have seen a lot of APIs pass success key to indicate if the request was successfully handled or not. There is no need to do that. Response status code should be used instead.

1# do not do this.
2message = "No car was found for car_id #{params[:car_id]}."
3render  json: { success: false, error: message }, status: :not_found
    ⌘F
      to navigateEnterto select Escto close
      Older
      Newer