management api's to delete a proxy from a product?

I am creating a script to remove dead proxies from a test org. Is there any way to force delete proxies that are still associated with a product? The problem I'm seeing is when you try to delete the proxy you get a constraint on the product. You then try to delete the product and you have a constraint on the app.

So my question is....are there any management api's to delete a proxy from a product? Or maybe just to force delete a proxy? Or do you just have to loop through all the dependencies to get to the point where you can remove the proxy?

0 1 366
1 REPLY 1

are there any management api's to delete a proxy from a product?

Yes. Here's some pseudo code

#
# update an existing API product. MUST provide displayName, approvalType, 
# name, and environments.
# If you omit proxies, it will update the product to have no proxies!
# Likewise attributes. 
#

PUT :mgmtserver/v1/o/:orgname/apiproducts/:product
Content-Type: application/json 
Authorization: :edge-auth

{
  "name" : ":product",
  "attributes" : [ {"name": "updated by", "value" : "dino"} ],
  "approvalType" : "manual",
  "displayName" : ":product",
  "scopes" : ["read", "write", "something_else"],
  "environments" : [ "prod" ], 
  "proxies": [
    "echo-1"
  ]
}

The best way to use this API is to first GET the API Product and then update it with only the changes you want to make - eg, remove the specific API Proxy from the product and keep everything else the same.

doc link