Page tree
Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

If connecting as an application, you will need to register an app and make a note of the app key and app secret.The WWClient can be instantiated by calling the static method WWClient.buildClientApplicationAccess(appId, appSecret, authenticationEndpoint). Once built, the WWClient can be authenticated. Once authenticated, all relevant Watson Work Services calls can be made.

Sample Code Block
    @Test(enabled = true)
    @Parameters({ "appId", "appSecret" })
    public void testGetSpacesAsApp(String appId, String appSecret) throws UnsupportedEncodingException, WWException {
        WWClient client = WWClient.buildClientApplicationAccess(appId, appSecret, new WWAuthenticationEndpoint());
        assert !client.isAuthenticated();
        client.authenticate();
        assert client.isAuthenticated();
        WWGraphQLEndpoint ep = new WWGraphQLEndpoint(client);
        List<? extends Space> spaces = ep.getSpaces();
        assert (spaces.size() > 0);
    } 
  • No labels