box / box-ios-sdk

iOS SDK for the Box Content API
https://developer.box.com
Apache License 2.0
123 stars 113 forks source link

Status code: 415: unsupported media type #930

Closed PJStation closed 1 month ago

PJStation commented 1 month ago

5.6.0 one file format is not supported causing the list request to throw an exception

"request" : {
    "body" : "",
    "headers" : {
      "Authorization" : "Bearer nzIK9oknSxX5zdvvlSvUPxaouTTKSWfH",
      "X-Box-UA" : "agent=box-swift-sdk/5.6.0; env=iPhone14,2/15.4.1"
    },
    "method" : "GET",
    "url" : {
      "host" : "api.box.com",
      "path" : "/2.0/folders/0/items",
      "query" : {

      },
      "scheme" : "https"
    }
  },
  "response" : {
    "body" : {
      "code" : "unsupported_media_type",
      "help_url" : "http://developers.box.com/docs/#errors",
      "message" : "Previews for 'conf' files are not yet supported.",
      "request_id" : "9eqdqzhtu67l0c78",
      "status" : 415,
      "type" : "error"
    },
    "headers" : {
      "Alt-Svc" : "h3=":443"; ma=2592000,h3-29=":443"; ma=2592000",
      "box-request-id" : "08461ad9e7c98f2f7197f6dedc048ac50",
      "Cache-Control" : "no-cache, no-store",
      "Content-Type" : "application/json",
      "Date" : "Fri, 20 Sep 2024 06:36:10 GMT",
      "Strict-Transport-Security" : "max-age=31536000",
      "Via" : "1.1 google",
      "x-envoy-upstream-service-time" : "501"
    },
    "statusCode" : 415
  },
lukaszsocha2 commented 1 month ago

Hi @PJStation, thanks for reaching us. The 415 response is returned by Box API because of expiring_embed_link parameter used in fields parameter. If you remove this property, the response should be successful. iOS SDK just returns response code returned by Box API. If you want to report a bug or propose an improvement for managing .conf files, you can reach Box support - https://support.box.com/hc/en-us. Please let me know if removing expiring_embed_link from fields parameter helped. Best, @lukaszsocha2

lukaszsocha2 commented 1 month ago

Here is the list of the supported file types for the preview: https://support.box.com/hc/en-us/articles/360043695794-Viewing-Different-File-Types-Supported-in-Box-Content-Preview .conf file is not on that list. Best, @lukaszsocha2

PJStation commented 1 month ago

Hi @PJStation, thanks for reaching us. The 415 response is returned by Box API because of expiring_embed_link parameter used in fields parameter. If you remove this property, the response should be successful. iOS SDK just returns response code returned by Box API. If you want to report a bug or propose an improvement for managing .conf files, you can reach Box support - https://support.box.com/hc/en-us. Please let me know if removing expiring_embed_link from fields parameter helped. Best, @lukaszsocha2

it's worked! I think expiring_embed_link can return nil and should not throw an exception in the list