Announcement

Collapse
No announcement yet.

Help API

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Help API


    excuse my bad english, first of all, I have a problem when I send images from a form via api, when I send an image of less than 20kbs it loads me without problem in the crm with the contact data, but if the image has a weight of 50kb or higher I have the following error:

    Exception: EspoClient: Unknown Error in /home/website/public_html/forms/EspoApiClient.php:141 Stack trace: #0 /home/website/public_html/forms/procesar.php(19): EspoApiClient->request('POST', 'Attachment', Array) #1 {main}


    include 'EspoApiClient.php';
    $client = new EspoApiClient('URLESPO');
    $client->setApiKey('APIKEY');
    $client->setSecretKey('SECRETKEY' );

    try {
    $response = $client->request('POST', 'Attachment', [
    'name' => $_FILES['file']["name"],
    "field" => "fotoDeCedula",
    "role" => "Attachment",
    "parentType" => "Contact",
    'type' => $_FILES['file']['type'],
    'size' => $_FILES['file']['size'],
    'file' => ',' . (base64_encode(file_get_contents($_FILES['file']['tmp_name'])))
    ]);
    } catch (Exception $e) {
    echo $e;
    }


    check the spouse log and it throws me this

    [2021-03-25 02:04:58] Espo.ERROR: (400) POST /{ESPOCRM}/api/v1/Attachment; line: 85, file: /home/website/public_html/{ESPOCRM}/application/Espo/Core/Controllers/Record.php [] []


    Thank you very much I hope someone can help me with my problem

  • #2
    The error is thrown here: https://github.com/espocrm/espocrm/b...Record.php#L85

    I suggest debugging. This error looks weird to me.

    Comment

    Working...
    X