Hello. I check the text for uniqueness, suggested to me by the method http://text.ru/api-check/manual#ac-link-topic-1 . It is necessary to get the text_uid parameter, and then send it further in the form of a uid, tell me how to implement it?

procedure TForm6.Button1Click(Sender: TObject); var post: TStringList; post_zapros:string; begin post:=TstringList.Create; IdHTTP1.HandleRedirects:=true; try post:= TStringList.Create; post.Add('text=' + Form6.Memo1.text); post.Add('userkey=e05eb8486456b1ed9e6a384556b7716f'); post_zapros:=IdHTTP1.Post('http://api.text.ru/post',post); except end; end; end. 

It turns out it is necessary to roughly catch the answer to the Post request.

Just now there is an error:

{ "Error_code": 112, "error_desc": "\ u041f \ u0440 \ u043e \ u0432 \ u0435 \ u0440 \ u044f \ u0435 \ u043c \ u044b \ u0439 \ u0442 \ u0435 \ u043a \ u0441 \ u0442 \ u0441 \ u043b \ u0438 \ u0448 \ u043a \ u043e \ u043c \ u043a \ u043e \ u0440 \ u043e \ u0442 \ u043a \ u0438 \ u0439 "}

    1 answer 1

    Your error -> "Checked text is too short."

    You have a memory leak the size of 2x TStringList . You, for some reason, create it 2 times and never release it.

    Server response to your request, look for properties starting with Response... ResponseText , ResponseCode and Response .

    Something like this: Form6.Memo1.text := IdHTTP1.ResponseText;

    Never do this:

     except end; 

    Better this way:

     post := TStringList.Create; try IdHTTP1.HandleRedirects := True; post.Add('text=' + Form6.Memo1.text); post.Add('userkey=e05eb8486456b1ed9e6a384556b7716f'); try post_zapros := IdHTTP1.Post('http://api.text.ru/post', post); except on E: Exception do ShowMessage(E.Message); // лучше так чем вообще ничего end; finnaly post.Free; end; 
    • the answer gets this HTTP / 1.1 200 OK - Nick_qd