Closed btastic closed 1 year ago
See here for example https://github.com/commercetools/commercetools-dotnet-core-sdk/blob/master/commercetools.Sdk/IntegrationTests/commercetools.Sdk.IntegrationTests/appsettings.test.json
And this as example how to instantiate this config https://github.com/commercetools/commercetools-dotnet-core-sdk/blob/0cbc0c85b066f07b9b28f780c452b5148ff2f74f/commercetools.Sdk/IntegrationTests/commercetools.Sdk.IntegrationTests/ClientsTest.cs#L37
Oh I did not mention that we do the creation of clients during runtime. Is that a thing we can do?
It should not be impossible but it‘s not documented and could be better supported by the SDK. For the moment take a look in the https://github.com/commercetools/commercetools-dotnet-core-sdk/blob/0cbc0c85b066f07b9b28f780c452b5148ff2f74f/commercetools.Sdk/commercetools.Sdk.DependencyInjection/DependencyInjectionSetup.cs#L40 and https://github.com/commercetools/commercetools-dotnet-core-sdk/blob/0cbc0c85b066f07b9b28f780c452b5148ff2f74f/commercetools.Sdk/commercetools.Sdk.HttpApi/DependencyInjectionSetup.cs#L54 how to setup a client manually.
Hey Ben, can you write me an email please? I would like to discuss some options with you.
Hi @jenschude I am trying to have two client setups for both api and importapi, they differs only on the ApiBaseAddress https://**import**.europe-west1.gcp.commercetools.com https://**api**.europe-west1.gcp.commercetools.com
I am using both UseCommercetoolsImportApi and UseCommercetoolsApi for each, but the ApiBaseAddress always overwritten by the last called configuration. Any idea how to solve that?
Hi @nullableobj
I think you hit the wrong repository. It should have been https://github.com/commercetools/commercetools-dotnet-core-sdk-v2 as the v2 SDK supports the Import-API
When looking into your issue I found a bug when registering the ProjectApiRoots in the service container. Already created a fix and will release it today. As a workaround it would be possible to create the ProjectApiRoots from the named clients itself like shown here:
Fixed it in 6.4.0
Thank you no it works! However, I found that commercetools.Sdk.ImportApi.Clien.ProjectApiRoot does not have support for ByProjectKeyStandalonePricesRequestBuilde and ByProjectKeyInventoriesRequestBuilder which are needed to import Standalone prices and inventories. I figured out how to do it via ByProjectKeyRequestBuilder though but it would be nice to add that support to ImportApi.Clien.ProjectApiRoot.
Thanks again!
In case a resource is missing it should always work to use ProjectApiRoot.With()
which returns the ByProjectKeyRequestBuilder. In the Java SDK we already added a test to check for missing methods in the ProjectApiRoot. Looks like we have to introduce a similar one for dotnet.
Hello, we are currently migrating to the new library. We are using the SDK to create
CtpClient
s (orClient
in the old version) different types of clients using different projects.This is used in a multi-tenancy setup where different customers have different needs but we only have one backend to handle the requests.
Right now I don't see a way to setup multiple clients with different configurations (project key, client secrets and so on).
Can you point me in a direction what I need to do?