Forum Discussion

bmoreira2000's avatar
bmoreira2000
Icon for Nimbostratus rankNimbostratus
Feb 18, 2021

iControlRest API - (policy_fk)

Hey, i'm receiving a strange error trying to create a policy from rest api.

 

{"code":400,"message":"01070712:3: Values (/Common/Drafts/routing_microservices) specified for policy rule (/Common/Drafts/routing_microservices svc_automation_teste): foreign key index (policy_FK) do not point at an item that exists in the database.","errorStack":[],"apiError":3}

 

Code:

curl -k -X POST \
    -u "${USER}:${PASS}" \
    "https://bipservers/mgmt/tm/ltm/policy/~Common~Drafts~routing_microservices/rules" \
    -H 'Accept: */*' \
    -H 'Content-Type: application/json' \
    -d '{
        "kind":"tm:ltm:policy:rules:rulesstate","name":"svc_'${HOST_FILTER}'","strategy":"first-match","fullPath":"svc_'${HOST_FILTER}'","selfLink":"https://localhost/mgmt/tm/ltm/policy/~Common~routing_microservices/rules/svc_'${HOST_FILTER}'?ver=13.1.3.5",
        "actionsReference":{"link":"https://localhost/mgmt/tm/ltm/policy/~Common~routing_microservices/rules/svc_'${HOST_FILTER}'/actions?ver=13.1.3.5","isSubcollection":true,"items":[{"kind":"tm:ltm:policy:rules:actions:actionsstate",
        "name":"0","fullPath":"0","selfLink":"https://localhost/mgmt/tm/ltm/policy/~Common~routing_microservices/rules/svc_'${HOST_FILTER}'/actions/0?ver=13.1.3.5","code":0,"expirySecs":0,"forward":true,"length":0,"offset":0,"pool":"/Common/'${HOST_FILTER}'",
        "poolReference":{"link":"https://localhost/mgmt/tm/ltm/pool/~Common~'${HOST_FILTER}'?ver=13.1.3.5"},"port":0,"request":true,"select":true,"status":0,"timeout":0,"vlanId":0}]},"conditionsReference":{"link":"https://localhost/mgmt/tm/ltm/policy/~Common~routing_microservices/rules/'${HOST_FILTER}'/conditions?ver=13.1.3.5",
        "isSubcollection":true,"items":[{"kind":"tm:ltm:policy:rules:conditions:conditionsstate","name":"0","fullPath":"0","selfLink":"https://localhost/mgmt/tm/ltm/policy/~Common~routing_microservices/rules/'${HOST_FILTER}'/conditions/0?ver=13.1.3.5","caseInsensitive":true,"external":true,"httpUri":true,"index":0,
        "path":true,"present":true,"remote":true,"request":true,"startsWith":true,"values":["/'${REDIRECT_PATH}'","/'${REDIRECT_PATH}'"]}]}
}'