你好
我想在Prism Central中使用REST API将类别分配给VM。
我不知道该怎么做
我需要使用此API吗
- “更新现有VM”(put /vms /{uuid})
或这个API
- “创建或更新类别值”(put/categories/{name}/{value})
我如何使用它来分配新类别而不删除先前的类别?
问候
帕斯卡
最好的答案帕斯卡姆
I have to use\u00a0 \u201cUpdate an existing VM\u201d (put \/vms\/{uuid})<\/p>
and the difficulty for me was to understand what I need to pass for the request payload\/body<\/p>
I need to specify a JSON with the current SPEC of the VM + the metadata with category list<\/p>
{
\u00a0 \"spec\": {
\u00a0\u00a0\u00a0\u00a0\u00a0 < every thing of current vm >
\u00a0 },
\u00a0 \"metadata\": {
\u00a0\u00a0\u00a0 \"kind\": \"vm\"
\u00a0\u00a0\u00a0 \"uuid\": <VM UUID>,
\u00a0\u00a0\u00a0 \"spec_version\": 3,
\u00a0\u00a0\u00a0 \"categories_mapping\": {
\u00a0\u00a0\u00a0\u00a0\u00a0 \"ABC1\": [
\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \"abc_1_1\"
\u00a0\u00a0\u00a0\u00a0\u00a0 ],
\u00a0\u00a0\u00a0\u00a0\u00a0 \"TEST2\": [
\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \"test1\"
\u00a0\u00a0\u00a0\u00a0\u00a0 ]
\u00a0\u00a0\u00a0 },
\u00a0\u00a0\u00a0 \"categories\": {
\u00a0\u00a0\u00a0\u00a0\u00a0 \"ABC1\": \"abc_1_1\",
\u00a0\u00a0\u00a0\u00a0\u00a0 \"TEST2\": \"test1\"
\u00a0\u00a0\u00a0 }
\u00a0 }
}<\/p>
\u00a0<\/p>
Not so easy to do but it was ok at the end<\/p>
Regards<\/p>","className":"post__content__best_answer"}">