I got it working!
Here is my sample code if anyone need it one day. It is result of reading some others posts...
----- Upload PDF file using HttpClient -----------
string ls_url,ls_status_text,ls_json,ls_odgovor,ls_rezultat,ls_key,ls_datum
integer li_rezultat,li_fileclose
long ll_status_code,ll_root,ll_stevilo,ll_index,ll_filelength
long ll_ChildArray
JSONParser ljson_pa
long ll_FileNo
blob blb_boundary,blb_terminus,blb_filename,blb_multipart
blob lb_file
string ls_napaka_name,ls_napaka_message,ls_napaka_code,ls_napaka_status, ls_conv_lb_file
string ls_BOUNDARY = "xxxxxxxxxx"
if isvalid(inv_HttpClientT) then
else
inv_HttpClientT = create httpclient
end if
if ii_tessera_connected=1 then
else
//of_set_login()
end if
ls_url=BaseUrl+'/api/v1/documents/upload'
ljson_pa= create JSONParser
inv_HttpClientT.clearrequestheaders( )
inv_HttpClientT.SetRequestHeader ("Content-Type", "multipart/form-data; boundary="+ls_BOUNDARY)
inv_HttpClientT.SetRequestHeader ("Authorization", "Bearer "+is_tessera_Bearer)
//read file in blob and close it
ll_FileNo=fileopen(as_filepath,StreamMode!)
ll_filelength=FileReadEx(ll_FileNo,lb_file)
li_fileclose=FileClose(ll_FileNo)
blb_boundary =blob('--' + ls_Boundary + '~r~n', EncodingUTF8!)
blb_terminus = blob('~r~n--' + ls_Boundary + '--~r~n', EncodingUTF8!)
blb_filename = blob('Content-Disposition: form-data; name="file"; filename='+ as_FileName+'~r~n' + "Content-Type: application/pdf~r~n~r~n", EncodingUTF8!) + lb_file
// Concatenate blobs into a single multipart blob
blb_multipart = blb_boundary + blb_filename + blb_terminus
li_rezultat=inv_HttpClientT.sendRequest( "POST",ls_url,blb_multipart)
ll_status_code=inv_HttpClientT.getresponsestatuscode( )
ls_status_text=inv_HttpClientT.getresponsestatustext( )
inv_HttpClientT.GetResponseBody(ls_odgovor)
ls_rezultat = ljson_pa.LoadString(ls_odgovor)
if ll_status_code=204 then //ok
RETURN 1
else //errors
//read JSON
ll_root = ljson_pa.GetRootItem()
ll_stevilo=ljson_pa.getchildcount( ll_root)
for ll_Index = 1 to ll_stevilo
ls_key = ljson_pa.GetChildKey(ll_root, ll_Index)
if ls_key='name' then
ls_napaka_name=ljson_pa.getitemstring( ll_root,ls_key)
elseif ls_key='message' then
ls_napaka_message=ljson_pa.getitemstring( ll_root,ls_key)
elseif ls_key='code' then
ls_napaka_code=ljson_pa.getitemstring( ll_root,ls_key)
elseif ls_key='status' then
ls_napaka_status=ljson_pa.getitemstring( ll_root,ls_key)
end if
next
if isnull(ls_napaka_code) then ls_napaka_code=''
if isnull(ls_napaka_name) then ls_napaka_name=''
if isnull(ls_napaka_message) then ls_napaka_message=''
if isnull(ls_napaka_status) then ls_napaka_status=''
Messagebox('Error','Ime napake: '+ls_napaka_name +'~r~n' + &
'Opis napake: '+ls_napaka_message+'~r~n' + &
'Coda napake: '+ls_napaka_code+'~r~n' + &
'Status napake: '+ls_napaka_status )
return -1
end if