How to fix imgur api error status 400, 417 errors



While uploading pictures using the Imgur API, some pictures are not uploaded and returns status 400 or 417 errors.

{
  status: 400,
  success: false,
  data: {
    error: "We don't support that file type!",
    request: '/3/upload'
}
{
  status: 417,
  success: false,
  data: {
    error: 'Internal expectation failed',
    request: '/3/upload',
    method: 'POST'
  }
}

This error was fixed upon launching the console. But every time I upload a picture I have to restart the console. How may I prevent this from happening?

Answer

The 417 error states that the Imgur CDN was expecting a file type such as .png, .mp4, .gif, etc. You may view the supported file types here.

The 400 indicates an improper / bad request , while requesting the API for a POST type request you must know how to properly request it, you may refer to the proper method here.



Source: stackoverflow