APIFunctionおよび関連関数のオプションで,全体的なクラウドの実行に影響するパラメータを許容するかどうかを指定する.
AllowedCloudExtraParameters
APIFunctionおよび関連関数のオプションで,全体的なクラウドの実行に影響するパラメータを許容するかどうかを指定する.
詳細
- AllowedCloudExtraParametersの設定は,All,Noneまたはリストでよい.
- 次は,AllowedCloudExtraParametersの設定によく含まれる要素である.
-
"_timeout" TimeConstrainedに相当する "_memorylimit" MemoryConstrainedに相当する "_geolocation" $GeoLocationの設定に相当する "_exportform" ExportFormに相当する "_responseform" ResponseFormに相当する - 追加的なパラメータの値は次のInterpreter指定を使って解釈される.
-
"_timeout" Restricted["Quantity","Seconds"] "_memorylimit" Restricted["Quantity","Bytes"] "_geolocation" "Location" "_exportform" "ExportFormatString" "_responseform" Restricted["ExportFormatString",…] - "_responseform"についての制約は{{"XML","JSON","RawJSON","WL","String","Text","HTML","HTMLFragment"}}である.
例題
すべて開く すべて閉じる例 (1)
APIFunctionの呼出し元が結果のエキスポートに使用するフォーマットを設定することを許可する:
api = CloudDeploy @ APIFunction[
"x" -> "String",
Identity,
AllowedCloudExtraParameters -> {"_exportform", "_responseform"}
]URLRead[
URLBuild[api, {"x" -> "something", "_exportform" -> "JSON"}],
"Body"
]"_exportform"パラメータが呼出しで指定されていない場合は,APIFunctionは結果をエキスポートしない:
URLRead[
URLBuild[api, {"x" -> "something"}],
"Body"
]スコープ (5)
AllowedCloudExtraParametersが"_exportform"に設定されている場合は,$ExportFormatsからの任意のフォーマットを使って応答をエキスポートすることができる.この場合,指定されていたエキスポートフォーマットは無効になる:
api = CloudDeploy @ APIFunction[
"x" -> "String",
Identity,
"JSON",
AllowedCloudExtraParameters -> {"_exportform"}
]URLRead[
URLBuild[api, {"x" -> "something", "_exportform" -> "XML"}],
"Body"
]AllowedCloudExtraParametersが"_responseform"に設定されている場合は,結果のResponseFormが返される:
api = CloudDeploy @ APIFunction[
"x" -> "Integer",
1 / #x &,
AllowedCloudExtraParameters -> {"_responseform"}
]URLRead[
URLBuild[api, {"x" -> "0", "_responseform" -> "JSON"}],
"Body"
]AllowedCloudExtraParametersが"_geolocation"に設定されている場合は,クライアントが別の$GeoLocationを指定することができる:
api = CloudDeploy @ APIFunction[
"city" -> "City",
GeoGraphics[Arrow@GeoPath[{$GeoLocation, #city}], GeoBackground -> "ReliefMap"] &,
"PNG",
AllowedCloudExtraParameters -> {"_geolocation"}
]URLExecute[api, {"city" -> "rome", "_geolocation" -> "lisbon"}, "PNG"]AllowedCloudExtraParametersが"_memorylimit"に設定されている場合は,クライアントがメモリ使用量の上限を指定することができる:
api = CloudDeploy@APIFunction[
"size" -> "Integer",
RandomImage[1, {#size, #size}]&,
"PNG",
AllowedCloudExtraParameters -> "_memorylimit"
]URLExecute[api, {"_memorylimit" -> "30000", "size" -> "100000"}]AllowedCloudExtraParametersが"_timeout"に指定されている場合は,クライアントが実行にかかる時間の上限を指定することができる:
api = CloudDeploy@APIFunction[
"sec" -> "Integer",
Pause[#sec]&,
AllowedCloudExtraParameters -> "_timeout"
]URLExecute[api, {"_timeout" -> "0.1", "sec" -> "1"}]特性と関係 (2)
"_exportform"を許可することは,事実上APIFunctionの第3引数を設定することに等しい:
api1 = CloudDeploy[
APIFunction["x" -> "Integer", Identity, AllowedCloudExtraParameters -> "_exportform"]
]api2 = CloudDeploy[
APIFunction["x" -> "Integer", Identity, "JSON"]
]URLRead[
URLBuild[api1, {"x" -> "1", "_exportform" -> "JSON"}],
"Body"
] === URLRead[
URLBuild[api2, {"x" -> "1"}],
"Body"
]"_responseform"を許可することは,事実上APIFunctionのボディをResponseFormで囲むことに等しい:
api1 = CloudDeploy[
APIFunction["x" -> "Integer", 1 / #x&, AllowedCloudExtraParameters -> "_responseform"]
]api2 = CloudDeploy[
APIFunction["x" -> "Integer", ResponseForm[1 / #x, "JSON"]&]
]ImportString[
URLRead[
URLBuild[api1, {"x" -> "0", "_responseform" -> "JSON"}], "Body"], "RawJSON"]["Result"]& /@ {api1, api2}考えられる問題 (1)
APIの呼出し元に"_responseform"の設定を許可することは,内部メッセージ等の配備されたAPIの詳細を公開することになるかもしれない:
myFun::message = "Something embarassing happened.";
myFun[2] := (Message[myFun::message];2)
myFun[x_] := x
api = CloudDeploy[APIFunction["x" -> "Integer", myFun[#x]&, AllowedCloudExtraParameters -> {"_responseform"}]]URLRead[
URLBuild[api, {"x" -> "2", "_responseform" -> "JSON"}],
"Body"
]関連するガイド
関連するワークフロー
- Web APIを配備する
テキスト
Wolfram Research (2017), AllowedCloudExtraParameters, Wolfram言語関数, https://reference.wolfram.com/language/ref/AllowedCloudExtraParameters.html.
CMS
Wolfram Language. 2017. "AllowedCloudExtraParameters." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/AllowedCloudExtraParameters.html.
APA
Wolfram Language. (2017). AllowedCloudExtraParameters. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/AllowedCloudExtraParameters.html
BibTeX
@misc{reference.wolfram_2026_allowedcloudextraparameters, author="Wolfram Research", title="{AllowedCloudExtraParameters}", year="2017", howpublished="\url{https://reference.wolfram.com/language/ref/AllowedCloudExtraParameters.html}", note=[Accessed: 14-August-2026]}
BibLaTeX
@online{reference.wolfram_2026_allowedcloudextraparameters, organization={Wolfram Research}, title={AllowedCloudExtraParameters}, year={2017}, url={https://reference.wolfram.com/language/ref/AllowedCloudExtraParameters.html}, note=[Accessed: 14-August-2026]}