Hello Team,
We get failures when executing PATCH /api/v2.0/companies()/attachments()/attachmentContent. The issue occurs randomly like 1 out of 20 times. When we retry the same request it passes successfully.
Here are more details of the requests we make:
DEBUG [2023-03-14 14:33:13,357] feign.Logger: [BusinessCentralHttpClient#createAttachment] ---> POST https://api.businesscentral.dynamics.com/v2.0/SANDBOX/api/v2.0/companies(b3c489de-77f1-ea11-bb64-000d3a492fdb)/attachments HTTP/1.1
DEBUG [2023-03-14 14:33:13,357] feign.Logger: [BusinessCentralHttpClient#createAttachment] Accept-Encoding: identity
DEBUG [2023-03-14 14:33:13,357] feign.Logger: [BusinessCentralHttpClient#createAttachment] Authorization: Bearer
DEBUG [2023-03-14 14:33:13,357] feign.Logger: [BusinessCentralHttpClient#createAttachment] Content-Length: 148
DEBUG [2023-03-14 14:33:13,357] feign.Logger: [BusinessCentralHttpClient#createAttachment] Content-Type: application/json
DEBUG [2023-03-14 14:33:13,357] feign.Logger: [BusinessCentralHttpClient#createAttachment]
DEBUG [2023-03-14 14:33:13,357] feign.Logger: [BusinessCentralHttpClient#createAttachment] {"parentId":"c21e1322-75c2-ed11-9a89-000d3ab1ea57","fileName":"f0977768-0367-4d1e-bddb-f555ac5ef321-p6s0DY.org.pdf","parentType":"Purchase Invoice"}
DEBUG [2023-03-14 14:33:13,357] feign.Logger: [BusinessCentralHttpClient#createAttachment] ---> END HTTP (148-byte body)
DEBUG [2023-03-14 14:33:13,753] feign.Logger: [BusinessCentralHttpClient#createAttachment] <--- UNKNOWN 201 (395ms)
DEBUG [2023-03-14 14:33:13,753] feign.Logger: [BusinessCentralHttpClient#createAttachment] access-control-allow-credentials: true
DEBUG [2023-03-14 14:33:13,753] feign.Logger: [BusinessCentralHttpClient#createAttachment] access-control-allow-headers: Origin, X-Requested-With, Authorization
DEBUG [2023-03-14 14:33:13,753] feign.Logger: [BusinessCentralHttpClient#createAttachment] access-control-allow-origin: *
DEBUG [2023-03-14 14:33:13,753] feign.Logger: [BusinessCentralHttpClient#createAttachment] access-control-expose-headers: Date, Content-Length, Server, OData-Version
DEBUG [2023-03-14 14:33:13,753] feign.Logger: [BusinessCentralHttpClient#createAttachment] access-control-expose-headers: ms-correlation-x
DEBUG [2023-03-14 14:33:13,753] feign.Logger: [BusinessCentralHttpClient#createAttachment] content-type: application/json; odata.metadata=minimal; odata.streaming=true; charset=utf-8
DEBUG [2023-03-14 14:33:13,753] feign.Logger: [BusinessCentralHttpClient#createAttachment] date: Tue, 14 Mar 2023 14:33:13 GMT
DEBUG [2023-03-14 14:33:13,753] feign.Logger: [BusinessCentralHttpClient#createAttachment] location: https://api.businesscentral.dynamics.com/v2.0/SANDBOX/api/v2.0/companies(b3c489de-77f1-ea11-bb64-000d3a492fdb)/attachments(c91e1322-75c2-ed11-9a89-000d3ab1ea57)
DEBUG [2023-03-14 14:33:13,753] feign.Logger: [BusinessCentralHttpClient#createAttachment] mise-correlation-id: 715a25ec-a329-4ecf-b366-a24af3658a65
DEBUG [2023-03-14 14:33:13,753] feign.Logger: [BusinessCentralHttpClient#createAttachment] ms-correlation-x: 31b50ca3-fcbb-052c-c1d9-2e5752dbd8ea
DEBUG [2023-03-14 14:33:13,753] feign.Logger: [BusinessCentralHttpClient#createAttachment] odata-version: 4.0
DEBUG [2023-03-14 14:33:13,753] feign.Logger: [BusinessCentralHttpClient#createAttachment] request-id: f9885e0f-d29f-4a24-a741-aa4188a740ed
DEBUG [2023-03-14 14:33:13,753] feign.Logger: [BusinessCentralHttpClient#createAttachment] server: Microsoft-HTTPAPI/2.0
DEBUG [2023-03-14 14:33:13,753] feign.Logger: [BusinessCentralHttpClient#createAttachment] strict-transport-security: max-age=31536000; includeSubDomains
DEBUG [2023-03-14 14:33:13,753] feign.Logger: [BusinessCentralHttpClient#createAttachment] vary: Accept-Encoding
DEBUG [2023-03-14 14:33:13,753] feign.Logger: [BusinessCentralHttpClient#createAttachment] x-content-type-options: nosniff
DEBUG [2023-03-14 14:33:13,753] feign.Logger: [BusinessCentralHttpClient#createAttachment]
DEBUG [2023-03-14 14:33:13,753] feign.Logger: [BusinessCentralHttpClient#createAttachment] {"@odata.context":"https://api.businesscentral.dynamics.com/v2.0/SANDBOX/api/v2.0/$metadata#companies(b3c489de-77f1-ea11-bb64-000d3a492fdb)/attachments/$entity","@odata.etag":"W/\"JzIwOzEzNTI1MTc5NzM0OTg0NDkzODc3MTswMDsn\"","id":"c91e1322-75c2-ed11-9a89-000d3ab1ea57","parentId":"c21e1322-75c2-ed11-9a89-000d3ab1ea57","fileName":"f0977768-0367-4d1e-bddb-f555ac5ef321-p6s0DY.org.pdf","byteSize":0,"lastModifiedDateTime":"2023-03-14T14:33:13Z","parentType":"Purchase_x0020_Invoice","attachmentContent@odata.mediaEditLink":"https://api.businesscentral.dynamics.com/v2.0/SANDBOX/api/v2.0/companies(b3c489de-77f1-ea11-bb64-000d3a492fdb)/attachments(c91e1322-75c2-ed11-9a89-000d3ab1ea57)/attachmentContent","attachmentContent@odata.mediaReadLink":"https://api.businesscentral.dynamics.com/v2.0/SANDBOX/api/v2.0/companies(b3c489de-77f1-ea11-bb64-000d3a492fdb)/attachments(c91e1322-75c2-ed11-9a89-000d3ab1ea57)/attachmentContent"}
DEBUG [2023-03-14 14:33:13,753] feign.Logger: [BusinessCentralHttpClient#createAttachment] <--- END HTTP (922-byte body)
DEBUG [2023-03-14 14:33:13,828] feign.Logger: [BusinessCentralHttpClient#uploadFile] ---> PATCH https://api.businesscentral.dynamics.com/v2.0/SANDBOX/api/v2.0/companies(b3c489de-77f1-ea11-bb64-000d3a492fdb)/attachments(c91e1322-75c2-ed11-9a89-000d3ab1ea57)/attachmentContent HTTP/1.1
DEBUG [2023-03-14 14:33:13,828] feign.Logger: [BusinessCentralHttpClient#uploadFile] Accept-Encoding: identity
DEBUG [2023-03-14 14:33:13,828] feign.Logger: [BusinessCentralHttpClient#uploadFile] Authorization: Bearer
DEBUG [2023-03-14 14:33:13,828] feign.Logger: [BusinessCentralHttpClient#uploadFile] Content-Length: 317264
DEBUG [2023-03-14 14:33:13,828] feign.Logger: [BusinessCentralHttpClient#uploadFile] Content-Type: application/pdf
DEBUG [2023-03-14 14:33:13,828] feign.Logger: [BusinessCentralHttpClient#uploadFile] If-Match: W/"JzIwOzEzNTI1MTc5NzM0OTg0NDkzODc3MTswMDsn"
DEBUG [2023-03-14 14:33:13,828] feign.Logger: [BusinessCentralHttpClient#uploadFile]
DEBUG [2023-03-14 14:33:13,828] feign.Logger: [BusinessCentralHttpClient#uploadFile] Binary data
DEBUG [2023-03-14 14:33:13,828] feign.Logger: [BusinessCentralHttpClient#uploadFile] ---> END HTTP (317264-byte body)
DEBUG [2023-03-14 14:33:14,154] feign.Logger: [BusinessCentralHttpClient#uploadFile] <--- UNKNOWN 500 (325ms)
DEBUG [2023-03-14 14:33:14,154] feign.Logger: [BusinessCentralHttpClient#uploadFile] access-control-allow-credentials: true
DEBUG [2023-03-14 14:33:14,154] feign.Logger: [BusinessCentralHttpClient#uploadFile] access-control-allow-headers: Origin, X-Requested-With, Authorization
DEBUG [2023-03-14 14:33:14,154] feign.Logger: [BusinessCentralHttpClient#uploadFile] access-control-allow-origin: *
DEBUG [2023-03-14 14:33:14,154] feign.Logger: [BusinessCentralHttpClient#uploadFile] access-control-expose-headers: Date, Content-Length, Server, OData-Version
DEBUG [2023-03-14 14:33:14,154] feign.Logger: [BusinessCentralHttpClient#uploadFile] access-control-expose-headers: ms-correlation-x
DEBUG [2023-03-14 14:33:14,154] feign.Logger: [BusinessCentralHttpClient#uploadFile] content-type: application/json; charset=utf-8
DEBUG [2023-03-14 14:33:14,154] feign.Logger: [BusinessCentralHttpClient#uploadFile] date: Tue, 14 Mar 2023 14:33:13 GMT
DEBUG [2023-03-14 14:33:14,154] feign.Logger: [BusinessCentralHttpClient#uploadFile] mise-correlation-id: 6373a3a0-860e-4f2c-85d9-2643644a1db4
DEBUG [2023-03-14 14:33:14,154] feign.Logger: [BusinessCentralHttpClient#uploadFile] ms-correlation-x: 3ad58f97-3cf8-b0d5-7bef-29264de7a393
DEBUG [2023-03-14 14:33:14,154] feign.Logger: [BusinessCentralHttpClient#uploadFile] request-id: 82293313-d811-4d66-82e1-9e5f52af3368
DEBUG [2023-03-14 14:33:14,154] feign.Logger: [BusinessCentralHttpClient#uploadFile] server: Microsoft-HTTPAPI/2.0
DEBUG [2023-03-14 14:33:14,154] feign.Logger: [BusinessCentralHttpClient#uploadFile] strict-transport-security: max-age=31536000; includeSubDomains
DEBUG [2023-03-14 14:33:14,154] feign.Logger: [BusinessCentralHttpClient#uploadFile] vary: Accept-Encoding
DEBUG [2023-03-14 14:33:14,154] feign.Logger: [BusinessCentralHttpClient#uploadFile] x-content-type-options: nosniff
DEBUG [2023-03-14 14:33:14,154] feign.Logger: [BusinessCentralHttpClient#uploadFile]
DEBUG [2023-03-14 14:33:14,155] feign.Logger: [BusinessCentralHttpClient#uploadFile]{
"error": {
"code": "Unknown",
"message": "A supported MIME type could not be found that matches the content type of the response. None of the supported type(s) 'Microsoft.OData.ODataMediaType, Microsoft.OData.ODataMediaType, Microsoft.OData.ODataMediaType, Microsoft.OData.ODataMediaType, Microsoft.OData.ODataMediaType, Microsoft.OData.ODataMediaType, Microsoft.OData.ODataMediaType, Microsoft.OData.ODataMediaType, Microsoft.OData.ODataMediaType, Microsoft.OData.ODataMediaType, Microsoft.OData.ODataMediaType, Microsoft.OData.ODataMediaType, Microsoft.OData.ODataMediaType, Microsoft.OData.ODataMediaType, Microsoft.OData.ODataMediaType, Microsoft.OData.ODataMediaType, Microsoft.OData.ODataMediaType, Microsoft.OData.ODataMediaType, Microsoft.OData.ODataMediaType, Microsoft.OData.ODataMediaType, Microsoft.OData.ODataMediaType, Microsoft.OData.ODataMediaType, Microsoft.OData.ODataMediaType, Microsoft.OData.ODataMediaType, Microsoft.OData.ODataMediaType, Microsoft.OData.ODataMediaType, Microsoft.OData.ODataMediaType, Microsoft.OData.ODataMediaType, Microsoft.OData.ODataMediaType, Microsoft.OData.ODataMediaType, Microsoft.OData.ODataMediaType, Microsoft.OData.ODataMediaTyp...' matches the content type 'application/pdf'."
}
}
DEBUG [2023-03-14 14:33:14,155] feign.Logger: [BusinessCentralHttpClient#uploadFile] <--- END HTTP (1254-byte body)