Doing an api request to add a file to bucket with CURL

Finally made it. Not without UiPath TechSup :grinning:

This is the correct method to upload:

  1. Creating a temporal link, with an api get request where path parameter is a NAME of file, that you want to see in orchestrator storage bucket (this is the spot where i failed - thought that this parameter is a prefix folder where i want to place it);
  2. Using this CULROptions to attach file and execute the request, where $uploadfile is a path of your file at server (machine where the service is living):
    curl_setopt_array($curl, array(
    CURLOPT_URL => $answer[Uri],
    CURLOPT_UPLOAD => true,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_BINARYTRANSFER => true,
    CURLOPT_SSL_VERIFYHOST => false,
    CURLOPT_SSL_VERIFYPEER => false,
    CURLOPT_ENCODING => ‘’,
    CURLOPT_MAXREDIRS => 10,
    CURLOPT_TIMEOUT => 0,
    CURLOPT_FOLLOWLOCATION => true,
    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
    CURLOPT_PUT => true,
    CURLOPT_INFILE => fopen($uploadfile, ‘rb’),
    CURLOPT_INFILESIZE => filesize($uploadfile),
    CURLOPT_HTTPHEADER => array(
    “Content-Type: application/json”,"Authorization: Bearer ".$neededtoken
    )
  3. Executing.
  4. PROFIT.