GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — twilio-java/examples/OrgsAPIExample.md at main · twilio/twilio-java

Expand file tree

/

OrgsAPIExample.md

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
34 lines (28 loc) · 1.62 KB
/

OrgsAPIExample.md

Copy path

File metadata and controls

34 lines (28 loc) · 1.62 KB
Raw
Copy raw file
Download raw file
Edit and raw actions
class OrgsAPIExample {
    public static void main {

        private static final String GRANT_TYPE = "grant_type_to_be_used";
        private static final String CLIENT_SID =
        "client_id_of_the_organization";
        private static final String CLIENT_SECRET = "client_secret_of_organization";
        private static final String ORGANISATION_ID = "id_of_the_organization";

        //Getting access token - Method #1
        Twilio.init(new OrgsClientCredentialProvider(CLIENT_SID, CLIENT_SECRET));
        fetchAccountDetails();


        //Scenario: 2 If in case one doesn't want to change the existing stored credential
        // Pass Custom TwilioRestClient
        // TokenManager tokenManager = new OrgsTokenManager(GRANT_TYPE, CLIENT_SID, CLIENT_SECRET);
        // TokenAuthStrategy tokenAuthStrategy = new TokenAuthStrategy(tokenManager);
        // TwilioRestClient client = new TwilioRestClient.Builder(tokenAuthStrategy).build();
        // fetchAccountDetailsWithClient(client);
    }

    private static void fetchAccountDetails() {
       ResourceSet<Account> accountSet = Account.reader(ORGANISATION_ID).read();
       String accountSid = accountSet.iterator().next().getAccountSid();
       System.out.println(accountSid);
    }

    private static void fetchAccountDetailsWithClient(TwilioRestClient client) {
       ResourceSet<Account> accountSet = Account.reader(ORGANISATION_ID).read(client);
       String accountSid = accountSet.iterator().next().getAccountSid();
       System.out.println(accountSid);
    }
}
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.