rest api server lazarus / 38-Networking and Web Programming ---------------------------------------------------------------------- Packs · 2024-02-29 05:29 I have created rest api server with endpoint . This end point should accept json object I have tried to access through ContentFields .it is not working . for nCtr := 0 to req.ContentFields.Count - 1 do         begin           Frmmain.Memo1.Lines.Add('pdf file' + req.ContentFields[nCtr]);         end; ---------------------------------------------------------------------- TRon · 2024-02-29 05:32 Quote from: Prakash on February 29, 2024, 06:29:22 amI have created rest api server with endpoint . This end point should accept json object I have tried to access through ContentFields .it is not working . for nCtr := 0 to req.ContentFields.Count - 1 do         begin           Frmmain.Memo1.Lines.Add('pdf file' + req.ContentFields[nCtr]);         end; Dear Prakash, There isn't even a question in there... ---------------------------------------------------------------------- Packs · 2024-02-29 05:33 Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure hallticket_rpt(req: TRequest; res: TResponse);var  dm_hallticket: Tdm_hallticket;  error, spdffile, sjsonfile: string;  nCtr: integer = 0;begin  dm_hallticket := Tdm_hallticket.Create(nil);  try    try     if req.Method = 'POST' then      begin         Frmmain.Memo1.Clear;      //ARequest.ContentFields.Values['Name'];          for nCtr := 0 to req.FieldCount - 1 do        begin          Frmmain.Memo1.Lines.Add('field name : ' + req.FieldNames[nCtr]);      end;         for nCtr := 0 to req. - 1 do        begin          Frmmain.Memo1.Lines.Add('field name : ' + req.FieldNames[nCtr]);      end;         for nCtr := 0 to req.ContentFields.Count - 1 do        begin          Frmmain.Memo1.Lines.Add('pdf file' + req.ContentFields[nCtr]);        end;         //Frmmain.Memo1.Lines.Text := req.ContentFields.Values['pdffile'];       spdffile := req.ContentFields.Values['pdffile'];        sjsonfile := req.ContentFields.Values['jsonfile'];         Frmmain.Memo1.Lines.Add('pdf file' + spdffile);        Frmmain.Memo1.Lines.Add('json file' + sjsonfile);        if spdffile = EmptyStr then        begin          JsonResponse(res, 'Pdf file not found', 500);          Exit;        end;         if sjsonfile = EmptyStr then        begin          debugln(MY_LOG_GROUP, ['jsonfile : ', sjsonfile]);          JsonResponse(res, 'json file not found', 500);          Exit;        end;         dm_hallticket.Pdffilename := spdffile;        dm_hallticket.Jsonfile := sjsonfile;        dm_hallticket.load_jsonfile;        dm_hallticket.print_hallticket;      jsonResponse(res, 'true');       end;    except      on E: Exception do      begin        error := '{"error": "' + E.Message + '"}';        JsonResponse(res, error, 500); // Internal Server Error    end;    end;  finally    dm_receipts.Free;  end;end;   and from postman sending { "pdffile":  "hallticket.pdf", "jsonfile": "1002_hallticket.json" } how to access the json object from request ---------------------------------------------------------------------- Packs · 2024-02-29 06:10 it is solved Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i D := GetJSON(req.Content);        spdffile := D.FindPath('pdffile').AsString;        sjsonfile := D.FindPath('jsonfile').AsString;