From RAD Studio API Documentation
Jump to: navigation, search


procedure AddBody(const ABodyContent: string; AContentType: TRESTContentType = ctNone); overload;
procedure AddBody<T: class, constructor>(AObject: T); overload;
procedure AddBody(AObject: TJsonObject; AOwnsObject: TRESTObjectOwnership = ooApp); overload;
procedure AddBody(ABodyContent: TStream; AContentType: TRESTContentType = ctNone;  AOwnsStream: TRESTObjectOwnership = ooCopy); overload;


void __fastcall AddBody(const System::UnicodeString ABodyContent, Rest::Types::TRESTContentType AContentType = (Rest::Types::TRESTContentType)(0x0))/* overload */;
template<typename T> void __fastcall AddBody(T AObject)/* overload */;
void __fastcall AddBody(System::Json::TJSONObject* AObject, Rest::Types::TRESTObjectOwnership AOwnsObject = (Rest::Types::TRESTObjectOwnership)(0x2))/* overload */;
void __fastcall AddBody(System::Classes::TStream* ABodyContent, Rest::Types::TRESTContentType AContentType = (Rest::Types::TRESTContentType)(0x0), Rest::Types::TRESTObjectOwnership AOwnsStream = (Rest::Types::TRESTObjectOwnership)(0x0))/* overload */;


Type Visibility Source Unit Parent
REST.Client TCustomRESTRequest


Uses the specified content as the body parameter of the request.

There are four different ways, in which you may specify the new value for the body parameter of your request:

  • If ABodyContent is a string or a stream, AddBody uses the specified content with the specified type as the body parameter of the request.
  • If AObject is an instance of TJSONObject or an object of a specified type, AddBody serializes the specified object as JSON and uses the serialized data as the value of the body parameter of the request.

Generally, a call to AddBody replaces any previous value of the body parameter. However, if you pass ABodyContent as a string, the specified value is appended, and the resulting request contains several body parameters; the name of each body parameter is "body" followed by a random GUID.

See Also