REST.Client.TCustomRESTRequest.AddBody

提供: RAD Studio API Documentation
移動先: 案内検索

Delphi

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;

C++

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 */;

プロパティ

種類 可視性 ソース ユニット
procedure
function
public
REST.Client.pas
REST.Client.hpp
REST.Client TCustomRESTRequest


説明

指定された内容を要求の本体パラメータとして使用します。

要求の本体パラメータに新しい値を指定する方法は 4 とおりあります。

  • ABodyContent文字列またはストリームである場合、AddBody では、指定されたタイプの指定された内容を要求の本体パラメータとして使用します。
  • AObjectTJSONObject のインスタンスまたは指定された型のオブジェクトである場合、AddBody では、指定されたオブジェクトを JSON としてシリアル化し、その結果を要求の本体パラメータの値として使用します。

一般に、AddBody を呼び出すと、それまでの本体パラメータの値がすべて置き換えられます。ただし、ABodyContent に文字列を渡した場合には、その値が追加され、結果として、要求には複数の本体パラメータが含まれることになります。それぞれの本体パラメータの名前は、"body" の後にランダムな GUID を付け加えたものになります。

関連項目