Difference between revisions of "MOR API Subscriptions get"

From Kolmisoft Wiki
Jump to navigationJump to search
 
Line 37: Line 37:
     <subscriptions>
     <subscriptions>
       <subscription>
       <subscription>
        <id>231</id>
         <user>Test User #1</user>
         <user>Test User #1</user>
         <device></device>
         <device></device>

Latest revision as of 09:05, 7 February 2020

NOTE: Available from MOR X5

Description

MOR API Subscriptions get

Usage

  • From MOR X5 Call: /api/subscriptions_get
  • Methods: POST, GET(if allowed, not recomended)



Parametres

  • u - username for authentication. Required.
  • service_id - Subscription's Service id.
  • subscription_activation_start - Subscription's Activation Start timestamp in System Time Zone (if defined - only time equal to it or after it).
  • subscription_activation_end - Subscription's Activation End timestamp in System Time Zone (if defined - only time equal to it or before it).
  • subscription_memo - Subscription's memo.
  • subscription_until_canceled - defines if Subscription can be Until canceled - can not to have Activation End (0 - off, 1 - on, default - off).
  • user_id - Subscription's User id
  • hash - SHA1 hash constructed using API_Secret_Key ( More described in Constructing hash). Required.



Request

We have: API Secret Key = secret

We send:

HTML POST: http://<SERVER_IP>/billing/api/subscriptions_get?&u=admin&service_id=2&subscription_activation_start=1307167264&subscription_activation_end=1307167265
&subscription_memo=Subscriptions memo&subscription_until_canceled=1&user_id=2&hash=e5e9fa1ba31ecd1ae84f75caaa474f3a663f05f4 

NOTE that username is not included in hash

Success

<page>
 <status>
   <subscriptions>
     <subscription>
       <id>231</id>
       <user>Test User #1</user>
       <device></device>
       <service>Service Name</service>
       <from>2011-06-04 06:01:04 +0200</from>
       <till></till>
       <time_left></time_left>
       <memo>Subscriptions memo</memo>
       <type>Subscription type</type>
       <price></price>
       <user_id></user_id>
     </subscription>
   </subscriptions>
 </status>
</page>




Errors

  • <error>No Subscriptions found</error> - Subscription was not found using specified params. Use correct params.
  • <error>You are not authorized to manage Subscriptions</error> - Such username does not exist in the database or User does not have rights to manage Subscriptions.
  • <error>Incorrect hash</error> - Hash was not correct. Check API_Secret_Key while concatenating hash_string.



See also