Limit size Variables

Questions and answers on how to get the most out of FFAStrans
Post Reply
taurojo
Posts: 35
Joined: Mon Dec 19, 2016 2:44 pm

Limit size Variables

Post by taurojo »

Hi!

I'm sending a JSON via API to convert a video within a workflow. Everything works fine, but I've detected a limitation. One of the user variables I'm sending in the JSON is a string variable used to provide content for the video. It's a long text that sometimes reports an error, depending on the length of the variable. I'm getting a 400 error from the API whe string variable is too long

I have two questions
First, how can I see the error from the API reception in the system log or something similar? And second, what text limitations do we have when sending a string?

What is the size limit?

Thanks!!
taurojo
Posts: 35
Joined: Mon Dec 19, 2016 2:44 pm

Re: Limit size Variables

Post by taurojo »

HI!

I'm troubleshooting an issue preventing me from sending large payloads within the JSON "s_web_cuerpo". The JSON structure is valid, encoded in UTF-8, and appears correct in all other aspects.

Code: Select all

[
    {
        "name": "s_web_titulo",
        "data": "kkkkkkkkk"
    },
    {
        "name": "s_web_subitulo",
        "data": "kkkkkkkkkk"
    },
    {
        "name": "s_web_cuerpo",
        "data": "<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p><p><strong>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</strong></p><p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>"
    },
    {
        "name": "s_web_piedefoto",
        "data": "kkkkkkkkkkkkkkk"
    },
    {
        "name": "s_web_tcsacarfotograma",
        "data": "00:00:00.000"
    },
    {
        "name": "s_web_emailparaenviar",
        "data": "iperez@informaciontv.es"
    }
]
taurojo
Posts: 35
Joined: Mon Dec 19, 2016 2:44 pm

Re: Limit size Variables

Post by taurojo »

I send data from a page in php

Code: Select all


// Sample JSON data
$jsonData = array(
  "wf_id" => $idConversor,
  "inputfile" => $videoFilePath,
  "variables" => array(
    array(
      "name" => "s_web_titulo",
      "data" => $Datos_titulo
    ),
    array(
      "name" => "s_web_subitulo",
      "data" => $Datos_subtitulo
    ),
    array(
      "name" => "s_web_cuerpo",
      "data" => utf8_encode($Datos_cuerpo)
    ),
    array(
      "name" => "s_web_piedefoto",
      "data" => $Datos_pieFoto
    ),
    array(
      "name" => "s_web_tcsacarfotograma",
      "data" => formatVideoTime($Datos_videoTime)
    ),
    array(
      "name" => "s_web_emailparaenviar",
      "data" => $emailEnvio
    )
  )
);


$jsonEncodedData = json_encode($jsonData, JSON_UNESCAPED_UNICODE);


// Set del API a enviar
$headers = array(
  "Content-Type: application/json; charset=utf-8" // Especifica UT8 charset
  );

// Send JSON data to API using cURL
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $ipConversor);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $jsonEncodedData);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($ch);
$responseStatus = curl_getinfo($ch, CURLINFO_HTTP_CODE);

// Cerramos el curl
curl_close($ch);

// Interpretamos el API response
$apiResponse = json_decode($response, true);

admin
Site Admin
Posts: 1687
Joined: Sat Feb 08, 2014 10:39 pm

Re: Limit size Variables

Post by admin »

Hi, sorry about the late reply...I've been on quite long vacation.
I don't think there is a problem with the variable size per se but maybe the payload in total. This particular issue was fixed in the lates release 1.4.0.7. So unless you're already updated, can you please do that and report back?

-steinar
Post Reply