mvanrijnen 123 Posted September 9, 2020 (edited) Hello, maybe someone can help me out with the following problem, serverside resource See following code, i post a request for updating something, serverside can not find body? this is what the post request, posts to the server (captured with fiddler): POST http://pc-pcname:8080/appointments/21140 HTTP/1.1 Connection: Keep-Alive Content-Type: application/json Accept: application/json, text/plain; q=0.9, text/html;q=0.8, Accept-Charset: utf-8, *;q=0.8 User-Agent: Embarcadero RESTClient/1.0 Content-Length: 435 Host: pc-ict1:8080 application/json{"ID":21140,"Description":"blah blah blah" "UpdateState":0} Server Side: procedure TAppoinmentResource.PostAppointment(const AContext: TEndpointContext; const ARequest: TEndpointRequest; const AResponse: TEndpointResponse); var jsonobj : TJSONObject; begin if ARequest.Body.TryGetObject(jsonobj) then begin // do something with the jsonobject end; end; Client Side procedure TPlannerRestClient.UpdateAppointment(const AAppointment: TPlannerAPIAppointment); var request : TRESTRequest; jsonstring : string; jsonobject : TJSONObject; begin request := NewRequest(resAppointment, TRESTRequestMethod.rmPOST); try request.ResourceSuffix := AAppointment.ID.ToString; // todo fix serialization TgoBsonSerializer.Serialize(AAppointment, jsonstring); jsonobject := TJSONObject.ParseJSONValue(jsonstring) as TJSONObject; request.ClearBody; request.AddBody(jsonobject); request.Execute; finally jsonobject.Free request.Free; end; end; Somebody a hint what i'm doing wrong? Edited September 9, 2020 by mvanrijnen Share this post Link to post
mvanrijnen 123 Posted September 9, 2020 Problem solved itself after restarting Delphi and clear all dcu's from the build. strange but true. Share this post Link to post