CS_threescale.Api.authorize C# (CSharp) Метод

authorize() публичный Метод

public authorize ( string app_id ) : AuthorizeResponse
app_id string
Результат AuthorizeResponse
        public AuthorizeResponse authorize(string app_id)
        {
            return aux_authorize(APP_ID,app_id, null);
        }

Same methods

Api::authorize ( string app_id, string app_key ) : AuthorizeResponse

Usage Example

Пример #1
0
        static void Main(string[] args)
        {
            try {
                string provider_key = "YOUR_PROVIDER_KEY";
                string app_id = "APP_ID_OF_THE_USER";

                Api _3ScaleAPI = new Api("http://su1.3scale.net", provider_key);

                AuthorizeResponse resp = _3ScaleAPI.authorize(app_id);

                print(resp);

                Console.WriteLine("Done authorize...");

                System.Collections.Hashtable transactions = new System.Collections.Hashtable();
                System.Collections.Hashtable transaction = null;
                System.Collections.Hashtable usage = null;

                transaction = new System.Collections.Hashtable();
                transaction.Add("app_id",app_id);
                transaction.Add("timestamp", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss K"));
                usage = new System.Collections.Hashtable();
                usage.Add("hits", 10);
                transaction.Add("usage",usage);
                transactions.Add("0", transaction);

                transaction = new System.Collections.Hashtable();
                transaction.Add("app_id", app_id);
                transaction.Add("timestamp", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss K"));
                usage = new System.Collections.Hashtable();
                usage.Add("hits", 1);
                transaction.Add("usage", usage);
                transactions.Add("1", transaction);
                _3ScaleAPI.report(transactions);

                Console.WriteLine("Done report...");
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }

            string s = Console.ReadLine();
        }
All Usage Examples Of CS_threescale.Api::authorize