Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding a file to a custom field when creating a deal #52

Open
SparTT opened this issue May 23, 2023 · 1 comment
Open

Adding a file to a custom field when creating a deal #52

SparTT opened this issue May 23, 2023 · 1 comment

Comments

@SparTT
Copy link

SparTT commented May 23, 2023

I'm trying to add an image to a custom field when I create a deal, but I've been receiving the same HTTPError.

I'm trying to execute the code below:

const imgData = [{
  fileData: [ "test-st.png", "iVBORw0KGgoAAAANSUh..." ] // fileData[1] is a base64 str 
}]

let data = await bitrix.deals.create({
    fields: {
      TITLE: "ST-TEST",
      CATEGORY_ID: 18,
      UF_CRM_1659988440473: 4759,
      UF_CRM_1678981077892: imgData, 
    },
  }, {
    REGISTER_SONET_EVENT: 'Y'
})

The full error is:

{
    "name": "HTTPError",
    "timings": {
        "start": 1684867744230,
        "socket": 1684867744231,
        "lookup": 1684867744255,
        "connect": 1684867744410,
        "secureConnect": 1684867744568,
        "upload": 1684867744568,
        "response": 1684867744880,
        "end": 1684867744881,
        "phases": {
            "wait": 1,
            "dns": 24,
            "tcp": 155,
            "tls": 158,
            "request": 0,
            "firstByte": 312,
            "download": 1,
            "total": 651
        }
    }
}

What can I do to solve this?

@mrhyde
Copy link
Member

mrhyde commented May 26, 2023

This is a long-standing issue with how we handle the requests to the Bitrix API. We are using GET requests and sending base64 encoded string will trigger 414 HTTP error. I will have to investigate if there anything we can do without changing too much code to make this work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants