Learn F5 Technologies, Get Answers & Share Community Solutions Join DevCentral

Filter by:
  • Solution
  • Technology
Clear all filters
Answers

Api Rest - create draft copy from published policy

Hi, cannot find the way to create draft copy of LTM policy. Documentation doesn't help, I tried similar way as publishing policy -> {command: "publish", name: "/Common/Drafts/targetpolicy"}, but instead of command "publish" I tried {command: "createDraft", name: "/Common/targetpolicy"} without luck..

Error response I got:

{
    "code": 501,
    "message": "0 is not supported ",
    "errorStack": [],
    "apiError": 1
}    

Does anyone know how to create draft copy from already published policy?

THx, Zdenek

0
Rate this Question

Answers to this Question

placeholder+image
USER ACCEPTED ANSWER & F5 ACCEPTED ANSWER

You are after tmsh modify ltm policy <publishedPolicy> create-draft equivalent, right? Can you try this?

curl -sku <user>:<pass> \
  https://<host>/mgmt/tm/ltm/policy/<publishedPolicy>?options=create-draft \
  -X PATCH -H "Content-type: application/json" \
  -d '{}'
0
Comments on this Answer
Comment made 1 month ago by Zdenda 451

Hi Satoshi, thanks, this works for me.

It's quite uncommon way of patching things.. Do you know whether this will stay in future, or should I prepare to rewrite my scripts once we upgrade to next major versions?

0
placeholder+image
USER ACCEPTED ANSWER & F5 ACCEPTED ANSWER

Are you saying that the method you tried worked before in an older version, but stopped working after upgrade? If that were the case, please give us the version numbers and the exact syntax (HTTP method, endpoint and payload). Thanks.

0
Comments on this Answer
Comment made 1 month ago by Zdenda 451

I am not saying that. I say that this is strange way of patching which I haven't seen anywhere else on F5 API. So I was worried whether this is some workaround which is going to be replaced in future, or whether this will stay.

0
placeholder+image
USER ACCEPTED ANSWER & F5 ACCEPTED ANSWER

The ?options query parameter is described in iControl® REST API User Guide Version : e.g., from p. 29 of the version 13.1 doc says:

options: Specifies the options to a query request. This parameter takes values that are compatible with the tmsh command-line options.

0
placeholder+image
USER ACCEPTED ANSWER & F5 ACCEPTED ANSWER

For more iControl REST examples for LTM policy (tmsh xxx ltm policy equivalent), see iControl REST Cookbook - LTM policy (ltm policy).

0