|
21 | 21 |
|
22 | 22 | import com.ibm.cloud.sdk.core.http.Response; |
23 | 23 | import com.ibm.cloud.sdk.core.http.ServiceCall; |
24 | | -import com.ibm.cloud.sdk.core.security.Authenticator; |
25 | | -import com.ibm.cloud.sdk.core.security.BasicAuthenticator; |
| 24 | +import com.ibm.cloud.sdk.core.security.BearerTokenAuthenticator; |
| 25 | +//import com.ibm.cloud.sdk.core.http.HttpConfigOptions; |
26 | 26 | import com.ibm.watson.health.acd.v1.model.AcdCartridges; |
27 | 27 | import com.ibm.watson.health.acd.v1.model.AcdCartridgesList; |
28 | 28 | import com.ibm.watson.health.acd.v1.model.AcdFlow; |
|
45 | 45 | /** |
46 | 46 | * Sample ACD Java SDK Calls |
47 | 47 | * |
48 | | - * NOTE: To run this sample class, replace "YOUR_APIKEY" below with your apikey |
49 | | - * for the Annotator for Clinical Data (ACD) service. Also, make sure the "url" |
50 | | - * reflects the ACD service instance. |
| 48 | + * NOTE: To run this sample class, replace "ACD_TOKEN" below with your ACD bearer token, |
| 49 | + * and replace "ACD_URL" with the URL for the Annotator for Clinical Data (ACD) service endpoint. |
51 | 50 | * |
52 | | - * Optional: Update the "version" if you require a specific version of ACD. |
| 51 | + * Optional: Update the "version" variable if you require a specific version of ACD. |
53 | 52 | */ |
54 | 53 | public class AnnotatorForClinicalDataExample { |
55 | 54 |
|
56 | 55 | protected AnnotatorForClinicalDataExample() { } |
57 | 56 |
|
58 | 57 | public static void main(String[] args) throws Exception { |
59 | | - String apikey = "YOUR_APIKEY"; |
60 | | - //String url = "https://us-east.wh-acd.cloud.ibm.com/wh-acd/api"; |
61 | | - String url = "https://us-south.wh-acd.cloud.ibm.com/wh-acd/api"; |
| 58 | + String authToken = "ACD_TOKEN"; |
| 59 | + String url = "ACD_URL"; |
62 | 60 | String version = "2022-02-24"; |
63 | 61 | AnnotatorForClinicalData acd = null; |
64 | 62 |
|
65 | | - Authenticator authenticator = new BasicAuthenticator.Builder() |
66 | | - .username("apikey") |
67 | | - .password(apikey) |
68 | | - .build(); |
69 | | - |
| 63 | + BearerTokenAuthenticator authenticator = new BearerTokenAuthenticator(authToken); |
70 | 64 | acd = new AnnotatorForClinicalData( |
71 | 65 | version, |
72 | 66 | AnnotatorForClinicalData.DEFAULT_SERVICE_NAME, |
73 | 67 | authenticator); |
74 | 68 | acd.setServiceUrl(url); |
| 69 | + // Uncomment the next 2 lines to disable SSL verification - not recommended |
| 70 | + //HttpConfigOptions options = new HttpConfigOptions.Builder().disableSslVerification(true).build(); |
| 71 | + //acd.configureClient(options); |
75 | 72 |
|
76 | 73 |
|
77 | 74 |
|
|
0 commit comments