I’m attempting to create a key that will use basic auth and running across documentation links that suggest various different ways, all are different and none work. The two attempts below were taken from what I could find on the forums and from the documentation…
first attempt
curl -X "POST" "https://gatewayURL/api/apis/keys/basic/{username}" \
-H 'x-tyk-authorization: authkey' \
-H 'Content-Type: application/json; charset=utf-8' \
-d $'{
"hmac_string": "",
"oauth_keys": {},
"apply_policy_id": "",
"tags": [],
"jwt_data": {
"secret": ""
},
"per": 1,
"quota_renews": 1406121006,
"basic_auth_data": {
"password": "password"
},
"apply_policies": [],
"is_inactive": false,
"quota_remaining": 0,
"meta_data": {},
"monitor": {
"trigger_limits": []
},
"allowance": 1000,
"org_id": "org_id",
"expires": -1,
"hmac_enabled": false,
"quota_max": -1,
"access_rights": {
"no idea what this is": {
"api_id": "API_ID",
"api_name": "API NAME",
"versions": [
"[\\"Default\\"]"
]
}
},
"oauth_client_id": "",
"rate": 10,
"quota_renewal_rate": 60
}'
Response back is “404 page not found”
Second Attempt:
curl -X "POST" "https://GatewayURL/tyk/keys/create" \
-H 'x-tyk-authorization: authkey' \
-H 'Content-Type: application/json; charset=utf-8' \
-d $'{
"hmac_string": "",
"oauth_keys": {},
"apply_policy_id": "",
"tags": [],
"jwt_data": {
"secret": ""
},
"per": 1,
"quota_renews": 1406121006,
"basic_auth_data": {
"username": "username",
"password": "password"
},
"apply_policies": [],
"is_inactive": false,
"quota_remaining": 0,
"meta_data": {},
"monitor": {
"trigger_limits": []
},
"allowance": 1000,
"org_id": "org_id",
"expires": -1,
"hmac_enabled": false,
"quota_max": -1,
"access_rights": {
"no idea what this is": {
"api_id": "API_ID",
"api_name": "API NAME",
"versions": [
"[\\"Default\\"]"
]
}
},
"oauth_client_id": "",
"rate": 10,
"quota_renewal_rate": 60
}'
Response back is “{“status”:“error”,“message”:“Failed to create key, ensure security settings are correct.”}”