Developer App creation with Management API

Hi @dchiesa1 ,

 

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": "-1"}'

 

 

Can you please help?

Solved Solved
1 4 328
1 ACCEPTED SOLUTION

1. keyexpiresin is not a timestamp since epoch, it's just duration in milliseconds.. That's why you got ~20 days initially.

2. An app does not have an expiresAt attribute. This attribute belongs to a credential. Please refer to the docs.

3. You're mixing different units (a seconds timestamp with a milliseconds duration). Again, you don't need to do this if using keyExpiresIn 

 

'{"name":"Test-App3","apiProducts": ["Test-App3"],"keyExpiresIn": 31536000000}'

 

View solution in original post

4 REPLIES 4

First one 1711436000 ms does seems to be appx 20 days..which is correct.If you need for 1 year then you need to use 31536000000 ms.

For second one you skipped the value of keyExpiresIn so it defaults to never..

Go thru below documentation in detail for better insights..

 Go thru https://apidocs.apigee.com/docs/developer-apps/1/routes/organizations/%7Borg_name%7D/developers/%7Bd...

keyExpiresIn vs expiresAt are two different attributes.

keyExpiresIn:

Lifetime of the consumer key that will be generated for the developer app, in milliseconds. The default value, -1, indicates an infinite validity period. Once set, the expiration can't be updated.

expiresAt:

Time the credentials expire in milliseconds since epoch.

Unsure on

Hi @API-Evangelist ,

There was a typo in my question; I have changed the second commands 

 

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": "-1"}'

 

My question is, the current unix timestamp is 1683220752

In the below cURL command if I use 1683220752 + 31536000000 (1 year) = 33,219,220,752 (1 year from now)

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": "33219220752"}'

But in Apigee the Developer App expiration time is just 20 days from today instead of 1 year.

Do Apigee have some different mechanism w.r.t unix time stamp?

@apickelsimer 

 

 

1. keyexpiresin is not a timestamp since epoch, it's just duration in milliseconds.. That's why you got ~20 days initially.

2. An app does not have an expiresAt attribute. This attribute belongs to a credential. Please refer to the docs.

3. You're mixing different units (a seconds timestamp with a milliseconds duration). Again, you don't need to do this if using keyExpiresIn 

 

'{"name":"Test-App3","apiProducts": ["Test-App3"],"keyExpiresIn": 31536000000}'

 

Thank you, @dknezic ! 🙂

Final cURL:

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-App5","apiProducts": ["Test-Product"],"keyExpiresIn": "31536000000"}'