ZEPETO.Multiplay.HttpService
11 分
型 説明 httpcontenttype /#httpcontenttype http の content type を指定する定数の列挙型。 httpbodytype /#httpbodytype http ボディの内容の型エイリアス。プレーンテキストまたはキーと値のオブジェクトのいずれかを指定できます。 httpheader /#httpheader http ヘッダーの型エイリアス。キーと値のオブジェクトを表します。 httperrortype /#httperrortype http リクエストが失敗した理由を指定する定数の列挙型。 httperror /#httperror http リクエスト中に発生したエラーを表します。 httpresponse /#httpresponse http レスポンスを表します。 httpservice /#httpservice httpservice は、外部の web サービスと http 接続を確立してリクエストを行うための api を提供します。 https プロトコルを使用してください。http は開発環境でのみサポートされます。 リクエストはポート 80 と 443 に限定されます。 リクエストボディとレスポンスボディの最大サイズは 16kb です。 リクエストが過剰になると world サービスに制限がかかる可能性があるため、1 分あたりのリクエスト数は 500 未満に抑えてください。 外部の web サービスが 5 秒以内に応答しない場合、リクエストは失敗します。 リクエストの失敗を防ぐため、レスポンスヘッダーの content type が httpcontenttype 列挙型で定義された値と一致していることを確認してください。 web リクエストはさまざまな理由で失敗する可能性があるため、防御的にコーディングすることをおすすめします。 httpcontenttype enum http の content type を指定する定数の列挙型。 名前 値 説明 applicationjson "application/json" application/json コンテンツタイプを表します。 applicationxml "application/xml" application/xml コンテンツタイプを表します。 applicationurlencoded "application/x www form urlencoded" application/x www form urlencoded コンテンツタイプを表します。 textplain "text/plain" text/plain コンテンツタイプを表します。 textxml "text/xml" text/xml コンテンツタイプを表します。 httpbodytype delegate http ボディの内容の型エイリアス。プレーンテキストまたはキーと値のオブジェクトのいずれかを指定できます。 string | { \[key string] any; } httpheader delegate http ヘッダーの型エイリアス。キーと値のオブジェクトを表します。 { \[key string] string | number; } httperrortype enum http リクエストが失敗した理由を指定する定数の列挙型。 名前 値 説明 err access denied "err access denied" エラー アクセスが拒否されました。 err length required "err length required" エラー 長さの指定が必要です。 httperror interface · extends error http リクエスト中に発生したエラーを表します。 プロパティ 名前 型 説明 message string エラーメッセージ。 code string httperrortype 列挙型の値として定義されたエラーコード。 httpresponse interface http レスポンスを表します。 プロパティ 名前 型 説明 statuscode number レスポンスのステータスコード。通常、200 はリクエストの成功を示します。 statustext string ステータスコードに対応するステータスメッセージ。通常、「ok」はリクエストの成功を示します。 response string http レスポンスのボディ。レスポンスの content type によって形式が異なる場合があります。受信した content type に応じた適切なパーサーを使用することをおすすめします。 httpservice interface httpservice は、外部の web サービスと http 接続を確立してリクエストを行うための api を提供します。 https プロトコルを使用してください。http は開発環境でのみサポートされます。 リクエストはポート 80 と 443 に限定されます。 リクエストボディとレスポンスボディの最大サイズは 16kb です。 リクエストが過剰になると world サービスに制限がかかる可能性があるため、1 分あたりのリクエスト数は 500 未満に抑えてください。 外部の web サービスが 5 秒以内に応答しない場合、リクエストは失敗します。 リクエストの失敗を防ぐため、レスポンスヘッダーの content type が httpcontenttype 列挙型で定義された値と一致していることを確認してください。 web リクエストはさまざまな理由で失敗する可能性があるため、防御的にコーディングすることをおすすめします。 メソッド getasync getasync(url string, headers? httpheader) → promise\<httpresponse> http get リクエストを非同期で実行します。 httperror をスローします。 パラメーター 型 説明 url string リクエストの送信先となる web アドレス。 headers (省略可能) httpheader /#httpheader http リクエストヘッダー。(省略可能) 戻り値 promise\<httpresponse> — 処理の完了時に httpresponse オブジェクトとともに解決される promise 。 postasync postasync(url string, body httpbodytype, headers? httpheader) → promise\<httpresponse> http post リクエストを非同期で実行します。 httperror をスローします。 パラメーター 型 説明 url string リクエストの送信先となる web アドレス。 body httpbodytype /#httpbodytype リクエストボディの内容。 headers (省略可能) httpheader /#httpheader http リクエストヘッダー。(省略可能) 戻り値 promise\<httpresponse> — 処理の完了時に httpresponse オブジェクトとともに解決される promise 。 postasync postasync(url string, body httpbodytype, httpcontenttype httpcontenttype, headers? httpheader) → promise\<httpresponse> http post リクエストを非同期で実行します。 httperror をスローします。 このシグネチャを使用する場合、headers に「content type」を追加しても、 httpcontenttype で指定した値によって上書きされます。 パラメーター 型 説明 url string リクエストの送信先となる web アドレス。 body httpbodytype /#httpbodytype リクエストボディの内容。 httpcontenttype httpcontenttype /#httpcontenttype リクエストの content type ヘッダーを指定します。 headers (省略可能) httpheader /#httpheader http リクエストヘッダー。(省略可能) 戻り値 promise\<httpresponse> — 処理の完了時に httpresponse オブジェクトとともに解決される promise 。