How to check loaded policies


#1

Trying to follow the example in https://tyk.io/tyk-documentation/security/security-policies/full-policies/ to apply a policy configured in policies.json to a key but receives error

"Failed to create key, keys must have at least one Access Rights record set.".

Here’s the command sent to tyk gateway :

curl -X POST -H "x-tyk-authorization: 352d20ee67be67f6340b4c0605b044b7" \
 -s \
 -H "Content-Type: application/json" \
 -X POST \
 -d '{
    "allowance": 1000,
    "rate": 1000,
    "per": 1,
    "expires": -1,
    "quota_max": -1,
    "org_id": "1",
    "quota_renews": 1449051461,
    "quota_remaining": -1,
    "quota_renewal_rate": 60,
    "apply_policy_id": "default",
    "meta_data": {}
 }' http://localhost:8080/tyk/keys/create | python -mjson.tool

#2

Hi sp_now,

The /tyk/keys/create endpoint you are targeting is to create an API Key with the REST API.

You should follow the appropriate tutorial in our Get started section.

Let me know if you need any further assistance.

Thanks,
Kos @ Tyk Support Team


#3

Hi Kos

apologies… think i figured out the solution.

The issue was due to the a different tyk.conf being picked up when running “service tyk-gateway start” and “./tyk”. Thefore the correct policies.json file was not picked up.

Thanks anyway


#4

The policy loader currently doesn’t show policies that have been loaded (whereas if using the dashboard it does), this has been addressed in this ticket here:

So is expected to be fixed in 2.4