API Documentation - GET
----------------------------

****************************************************************************
       NOTE : All GET URLs have to be URL encoded properly.

       Please go through the FAQ section at the end for general
       queries that might be answered there.
****************************************************************************




The following methods are exposed through the GET API :

========================
1.  Creating an order
========================

Description : Create a blank order, to which, calls can be added later.
URL : /api/voice/createOrder/

               * Parameters ( Have to be URL encoded )
                   - username
                   - password
                   - ivr_id
                       + the ID of the IVR to be attached to the order.

               * The following are optional params, and can be provided.
                   - end_time
                       + to be provided in yyyy-mm-dd hh:mm:ss format.
                       + if not provided, assumed to be now + 24 hours.
                   - start_time
                       + to be provided in yyyy-mm-dd hh:mm:ss format.
                       + if not provided, assumed to be now .
                   - retry_time
                       + to be provided as an integer
                       + if not provided, assumed to be 30 minutes.
                   - num_tries
                       + to be provided as an integer.
                       + if not provided, assumed to be 3.

e.g: /api/voice/createOrder/?username=bob&password=alice&ivr_id=11

Returns : Order ID

================================
2. Adding Calls to Order
================================

Description : Add calls to an Order created earlier.
URL: /api/voice/addCallsToOrder/

                      * must contain the following parameters and
their values :
                           - username
                           - password
                           - order_id
                               + ID of the order to which calls are
to be attached.
                           - phone_book
                               + Comma separated list of numbers/phonebooks.
                               + Can be in one of the following formats :
                                   - 9999988888,11112222  <-- used
when no TTS is required, i.e: normally.
                                   -
'9999988888,b,c,d','1111122222,c,d,e' <--- used when TTS is required.


                      * The following are optional params, and can be provided.
                           - priority
                               + priority of the calls, high = 1 , low = 0
                               + if not provided, assumed to be 0.


e.g: /api/voice/addCallsToOrder/?username=bob&password=alice&order_id=xxxxx-yyyyy-zzzzz

Returns : A list of Call IDs corresponding to the phone numbers to
which calls were placed.



================================
3. Getting Call Details
================================

Description : Get the Details of a call ( or calls ) placed.
URL: /api/voice/getLog/


       - Parameters
       --------------------------
                    * must contain the following params and their values :
                           - username
                           - password
                           - call_id
                               + a comma separated and quoted list of call IDs.
                               + e.g: "aaaaa-bbbbb-ccccc","fffff-ggggg-ggggg"




e.g: /api/voice/getLog/?username=bob&password=alice&call_id='"xxxxx-yyyyy-zzzzz","fffff-gggggg"'

Returns : A list of CDR ( Log ) entries in case calls have completed.

================================
4. Making a quick call
================================

Description : Make a call without creating an order.
URL: /api/voice/quickCall/


       Parameters
       --------------------------

                      * must contain the following params and their values :
                           - username
                           - password
                           - ivr_id
                               + ID of the IVR to be used for this quick Call.
                           - phone_book
                               + Comma separated list of numbers/phonebooks.
                               + Can be in one of the following formats :
                                   - 9999988888,11112222  <-- used
when no TTS is required, i.e: normally.
                                   -
'9999988888,b,c,d','1111122222,c,d,e' <--- used when TTS is required.

                       * the following params are optional :
                           - priority
                               + priority of the calls. high = 1, low = 0
                               + if not provided, are assumed to be 0




e.g: /api/voice/quickCall/?username=bob&password=alice&ivr_id=99&phone_book=9560038883

Returns : A list containing [ order ID, [ list of Call IDs ] ]

================================
5. Making a live call
================================

Description : Make a 'live' call between two numbers.
URL: /api/voice/liveCall/

       - Parameters
       --------------------------

                      * must contain the following params and their values :
                           - username
                           - password
                           - order_id
                               + order_id to which we can attach this call.
                           - caller
                               + phone number of the first leg of the
live call.
                               + the live call will go to this leg
first, and later get connected
                                 to the other leg.
                           - called
                               + phone number of the second leg of
the live call.


                       * the following params are optional :
                           - priority
                               + priority of the call placed. high = 1, low = 0
                               +  if not provided, is assumed to be 1


e.g: /api/voice/liveCall/?username=bob&password=alice&order_id='"xxxxx-yyyyy-zzzzz"&caller=9560038883&called=9999988888

Returns : Call ID of the call to the first leg of the bridge.

================================
6. Making a quick live call
================================

Description : Make a 'live' call between two numbers without creating an order.
URL: /api/voice/quickLiveCall/


       - Parameters
       --------------------------
                      * must contain the following params and their values :
                           - username
                           - password
                           - caller
                               + the number of the first leg of the live call.
                           - called
                               + the number of the second leg of the live call.

                       * the following keys are optional :
                           - priority
                               + the priority of the call. high = 1, low = 0
                               + if not provided, is assumed to be 1


e.g: /api/voice/liveCall/?username=bob&password=alice&caller=9560038883&called=9999988888

Returns : [Order Id, Call Id of the first leg of the bridge.]

================================
7. Checking your credits
================================

Description : Get the number of credits available with you.
URL: /api/voice/credit/get/


       - Params
       --------------------------
                   - username
                   - password


e.g: /api/voice/livecall/?username=alice&password=bob

Returns : Credits left with the user.

================================
8. Making a credit transfer
================================

Description  : Transfer credits from yourself to another user ( Restricted. )
URL: /api/voice/credit/transfer/


       Parameters
       --------------------------
                      * must contain the following params and their values :
                           - username
                           - password
                           - child
                               + the child ID to which credits have
to be transferred
                           - credits
                               + Credits to be transferred to the
child from the authenticated user.


e.g: /api/voice/credit/transfer/?username=alice&password=bob&child=22&credits=100

Returns : The number of credits transferred or error messages in case
of inappropriate permissions.




=================================================================
                   FAQ
=================================================================

   Q. What format will the API return me data in ?
    Ans :
    By default : JSON format. However, you can customize the data
received from the API through the
          'format' parameter in the request by appending
"&format=xxx" to the URL, where xxx can be :

               1. xml   - this will provide an XML based output
               2. json  - this will provide a JSON output ( this is
the default )
               3. mintxt - this will provide a minimal txt output
               4. txt    - this will provide a txt output
               5. yaml   - this will provide a YAML output

          - providing any other value for the key will default to xml.

    Q. Is GET preferred over POST ?
    Ans:
       No. GET is veryinsecure. However, it is much easier to use.
Even so, we recommend POST.