REST.Client.TBodyParams.Add

From Appmethod Libraries
Jump to: navigation, search

Object Pascal

class procedure Add(const AParams: TRESTRequestParameterList; const ABodyContent: string; AContentType: TRESTContentType = ctNone); overload; static;
class procedure Add<T: class, constructor>(const AParams: TRESTRequestParameterList; const AObject: T); overload; static;
class procedure Add(const AParams: TRESTRequestParameterList; const AObject: TJsonObject); overload; static;
class procedure Add(const AParams: TRESTRequestParameterList; const ABodyContent: TStream; AContentType: TRESTContentType = ctNone); overload; static;

C++

static void __fastcall Add(TRESTRequestParameterList* const AParams, const System::UnicodeString ABodyContent, Rest::Types::TRESTContentType AContentType = (Rest::Types::TRESTContentType)(0x0))/* overload */;
template<typename T> static void __fastcall Add(TRESTRequestParameterList* const AParams, const T AObject)/* overload */;
static void __fastcall Add(TRESTRequestParameterList* const AParams, System::Json::TJSONObject* const AObject)/* overload */;
static void __fastcall Add(TRESTRequestParameterList* const AParams, System::Classes::TStream* const ABodyContent, Rest::Types::TRESTContentType AContentType = (Rest::Types::TRESTContentType)(0x0))/* overload */;

Properties

Type Visibility Source Unit Parent
procedure
function
public
REST.Client.pas
REST.Client.hpp
REST.Client TBodyParams

Description

Adds the specified content as a body parameter to the specified parameter list of a REST request.

There are four different ways, in which you may specify the value for the body parameter to add to <AParams>:

  • If <ABodyContent> is a string or a stream, Add 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, Add 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 Add 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