User management API updates

There are lost of new changes in the pipeline but a few are already live in the system. One of these are useful tweaks to the user management API requested by a good number of people. The updated documentation is available on the docs page – the changes now allow you to:

  • set your own user keys on account creation.
  • refresh user keys via the API that you think might have been compromised
  • get metric usage update information via the API for any account.

So from now on, a normal signup is as before:

 
  curl -d "provider_key=3scale-5fc9d398ac02318e4e8f212cc1e8cf01d2&user[username]=tester_two&user[email]=tester_two@test.com" http://server.3scale.net.localhost:3000/plans/924795943/signup.xml
 

But you can sign up a new user with a given user_key:

 
   curl -d "provider_key=3scale-5fc9d398ac038e4e8f212cc1e8cf01d2&user[username]=tester_two&user[email]=tester@test.com&user_key=TEST_KEY123456789" http://server.3scale.net.localhost:3000/plans/924795943/signup.xml
 

and refresh a user key, by passing empty user_key:

 
   curl -d "_method=put&provider_key=3scale-5fc9d398ac038e4e8f212cc1e8cf01d2&user_key=" http://server.3scale.net.localhost:3000/users/tester_one.xml
 

You can also now set your own key prefixes (no more 3scale-… in front of your keys) if you like – contact support@3scale.net to get this feature enabled for your account.

Lastly to see status information for your users we’ve updated the GET to /buyer/contract.xml method, which now also returns a status object like this:

 
  <status>
   <usage metric="hits" period="month">
    <period_start>2009-08-01 00:00:00</period_start>
    <period_end>2009-08-31 23:59:59</period_end>

    <current_value>17344</current_value>
    <max_value>20000</max_value>
   </usage>

   <usage metric="hits" period="day">

    <period_start>2009-08-19 00:00:00</period_start>
    <period_end>2009-08-19 23:59:59</period_end>
    <current_value>732</current_value>
    <max_value>1000</max_value>

   </usage>

   <usage metric="hits" period="hour">
    <period_start>2009-08-19 22:00:00</period_start>
    <period_end>2009-08-19 22:59:59</period_end>

    <current_value>26</current_value>
    <max_value>100</max_value>
   </usage>
  </status>
 

This makes it possible to display usage information to users you’ve signed up via API. Look out for more changes coming up!

0 comments

  • http://twitter.com/gesf Gonçalo Fontoura

    The above link “docs page” is giving a 404 …

    • http://www.3scale.net/ Guillaume

      Thank you for pointing that. I have corrected it.

      However please note that the post is from 2009 and that now all information on our Management APIs are available from the 3scale support site at https://support.3scale.net/reference/activedocs.