Skip to main content

Notifications

Announcements

No record found.

Small and medium business | Business Central, N...
Suggested answer

PATCH /api/v2.0/companies()/attachments()/attachmentContent fails randomly

Posted on by 20

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)

Could you help us understand what the problem is and how to resolve it? 

  • Suggested answer
    Inge M. Bruvik Profile Picture
    Inge M. Bruvik 32,748 Super User 2024 Season 1 on at
    RE: PATCH /api/v2.0/companies()/attachments()/attachmentContent fails randomly

    Yes, that is correct.

    In some special cases you can purchase a special support agreement and handle it yourself. But then you will have to be a major account for Microsoft.

    And your partner handling this on your behalf is a part of what they need to offer you so you kind of already pay for their assistance but they  might charge for the time they use depending on your agreement with them.

  • AniN Profile Picture
    AniN 20 on at
    RE: PATCH /api/v2.0/companies()/attachments()/attachmentContent fails randomly

    So to sum up, the only way to report an issue related to Business Central is to contact the partner where we purchased the license and request them to open a support ticket with Microsoft, is that right?

  • Suggested answer
    Inge M. Bruvik Profile Picture
    Inge M. Bruvik 32,748 Super User 2024 Season 1 on at
    RE: PATCH /api/v2.0/companies()/attachments()/attachmentContent fails randomly

    Basically you should contact the partner where you purchased your license and request them to open a support ticket with Microsoft. That is nothing and end-user can do on their own.

  • AniN Profile Picture
    AniN 20 on at
    RE: PATCH /api/v2.0/companies()/attachments()/attachmentContent fails randomly

    Hello,

    Raising a ticket in https://partner.microsoft.com/ (if this is what you mean by "partner") did not help as this issue was out of their scope.

    I am not aware what CSP is, could you please clarify and provide a link if possible?

    Thanks!

  • Suggested answer
    Marco Mels Profile Picture
    Marco Mels on at
    RE: PATCH /api/v2.0/companies()/attachments()/attachmentContent fails randomly

    Hello,

    If you have a repro, please raise it to Microsoft via your CSP or partner.

    Thank you.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans