File tree 2 files changed +38
-0
lines changed
commercetools/internal-docs/src
main/java/com/commercetools/docs/meta
2 files changed +38
-0
lines changed Original file line number Diff line number Diff line change 23
23
*
24
24
* {@include.example example.ImportExamplesTest#instance()}
25
25
*
26
+ * <h3 id="custom-urls">Custom URLs</h3>
27
+ *
28
+ * To use custom URLs for API endpoints and authentication you have to provide the base URIs to the defaultClient method
29
+ *
30
+ * {@include.example example.ImportExamplesTest#customUrls()}
31
+ *
26
32
* <h3 id="custom-client">Custom HTTP client</h3>
27
33
*
28
34
* <p>The builder can be instantiated with a custom {@link io.vrap.rmf.base.client.VrapHttpClient} instance. For example a
Original file line number Diff line number Diff line change @@ -79,6 +79,38 @@ public void instance() {
79
79
.build (),
80
80
ServiceRegion .GCP_EUROPE_WEST1 )
81
81
.build ("my-project" );
82
+
83
+ // Project scoped ApiRoot config for Europe projects
84
+ ProjectApiRoot projectApiRootGcpEu = ApiRootBuilder .of ()
85
+ .defaultClient (ClientCredentials .of ()
86
+ .withClientId ("your-client-id" )
87
+ .withClientSecret ("your-client-secret" )
88
+ .build (),
89
+ ServiceRegion .valueOf ("GCP_EUROPE_WEST1" ))
90
+ .build ("my-project" );
91
+ }
92
+
93
+ public void customUrls () {
94
+ // Project scoped ApiRoot config using ServiceRegion class
95
+ ProjectApiRoot projectApiRoot = ApiRootBuilder .of ()
96
+ .defaultClient (
97
+ ClientCredentials .of ()
98
+ .withClientId ("your-client-id" )
99
+ .withClientSecret ("your-client-secret" )
100
+ .build (),
101
+ ServiceRegion .GCP_EUROPE_WEST1 .getOAuthTokenUrl (), ServiceRegion .GCP_EUROPE_WEST1 .getApiUrl ())
102
+ .build ("my-project" );
103
+
104
+ // Project scoped ApiRoot config using URI strings
105
+ ProjectApiRoot projectApiRoot2 = ApiRootBuilder .of ()
106
+ .defaultClient (
107
+ ClientCredentials .of ()
108
+ .withClientId ("your-client-id" )
109
+ .withClientSecret ("your-client-secret" )
110
+ .build (),
111
+ "https://auth.europe-west1.gcp.commercetools.com/oauth/token" ,
112
+ "https://api.europe-west1.gcp.commercetools.com/" )
113
+ .build ("my-project" );
82
114
}
83
115
84
116
public void timeoutMiddleware () {
You can’t perform that action at this time.
0 commit comments