Creation Developer App with Management API

Hi @dknezic ,

I am making a request to create Developer App in Apigee edge with the below request.

 

curl -X POST -v -u abc@xyz.com -H "Content-Type:application/json" localhost:8080/v1/organizations/org/developers/abc@xyz.com/apps -d '{"name":"Test-App3","apiProducts": ["Test-App3"],"keyExpiresIn": "1711436000"}'

 

If we look at keyExpiresIn is around 1 year from now. If I look in the Developer App Test-App3 in the UI, expiry is just 20 days from now.

If I use the below request, Developer App expiry is "Never"

 

curl -X POST -v -u abc@xyz.com -H "Content-Type:application/json" localhost:8080/v1/organizations/org/developers/abc@xyz.com/apps -d '{"name":"Test-App3","apiProducts": ["Test-App3"],"expiresAt": "1711436000"}'

 

Can you please help?

Solved Solved
0 2 190
1 ACCEPTED SOLUTION

The `keyExpiresIn` and `expiresAt` fields are integers, not strings.

Specifically for `keyExpiresIn`, you can check this in the docs: https://apidocs.apigee.com/docs/developer-apps/1/routes/organizations/%7Borg_name%7D/developers/%7Bd...

Screenshot 2023-04-05 at 10.37.18 AM.png

You need to convert the duration into milliseconds. 365 days is 31536000000 in ms.

A valid payload to create an app with a one year expiration would be:

 

curl -L -X POST 'http://localhost:8080/v1/organizations/org/developers/developer@example.com/apps' \
-H 'Content-Type: application/json' \
-H 'Authorization: Basic {CREDS}' \
-D '{
    "name": "Test-App3",
    "apiProducts": [
        "Test-App3"
    ],
    "keyExpiresIn": 31536000000
}'

 

 

View solution in original post

2 REPLIES 2

The `keyExpiresIn` and `expiresAt` fields are integers, not strings.

Specifically for `keyExpiresIn`, you can check this in the docs: https://apidocs.apigee.com/docs/developer-apps/1/routes/organizations/%7Borg_name%7D/developers/%7Bd...

Screenshot 2023-04-05 at 10.37.18 AM.png

You need to convert the duration into milliseconds. 365 days is 31536000000 in ms.

A valid payload to create an app with a one year expiration would be:

 

curl -L -X POST 'http://localhost:8080/v1/organizations/org/developers/developer@example.com/apps' \
-H 'Content-Type: application/json' \
-H 'Authorization: Basic {CREDS}' \
-D '{
    "name": "Test-App3",
    "apiProducts": [
        "Test-App3"
    ],
    "keyExpiresIn": 31536000000
}'

 

 

Hi @apickelsimer ,

I am using below command, but the credentials expiry is set to never.

In the Documentation there is no "KeyExpiresIn" attribute. How can I achieve this?

curl -v -k -H 'Content-type:application/json' -u abc@example.com 'localhost:8080/v1/organizations/org/developers/developer/apps/test-App/keys/create' -X POST -d \
'{"consumerKey":"abc","consumerSecret": "xyz", "keyExpiresIn": 31536000000}'