// Initialize the client
var client = new IngestionClient(
new IngestionConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY", "ALGOLIA_APPLICATION_REGION")
);
// Call the API
var response = await client.CreateSourceAsync(
new SourceCreate
{
Type = Enum.Parse<SourceType>("Commercetools"),
Name = "sourceName",
Input = new SourceInput(
new SourceCommercetools
{
StoreKeys = new List<string> { "myStore" },
Locales = new List<string> { "de" },
Url = "http://commercetools.com",
ProjectKey = "keyID",
ProductQueryPredicate =
"masterVariant(attributes(name=\"Brand\" and value=\"Algolia\"))",
}
),
AuthenticationID = "6c02aeb1-775e-418e-870b-1faccd4b2c0f",
}
);
// print the response
Console.WriteLine(response);
// Initialize the client
final client = IngestionClient(
appId: 'ALGOLIA_APPLICATION_ID',
apiKey: 'ALGOLIA_API_KEY',
region: 'ALGOLIA_APPLICATION_REGION');
// Call the API
final response = await client.createSource(
sourceCreate: SourceCreate(
type: SourceType.fromJson("commercetools"),
name: "sourceName",
input: SourceCommercetools(
storeKeys: [
"myStore",
],
locales: [
"de",
],
url: "http://commercetools.com",
projectKey: "keyID",
productQueryPredicate:
"masterVariant(attributes(name=\"Brand\" and value=\"Algolia\"))",
),
authenticationID: "6c02aeb1-775e-418e-870b-1faccd4b2c0f",
),
);
// print the response
print(response);
// Initialize the client with your application region, eg. ingestion.ALGOLIA_APPLICATION_REGION
client, err := ingestion.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY", ingestion.US)
if err != nil {
// The client can fail to initialize if you pass an invalid parameter.
panic(err)
}
// Call the API
response, err := client.CreateSource(client.NewApiCreateSourceRequest(
ingestion.NewEmptySourceCreate().
SetType(ingestion.SourceType("commercetools")).
SetName("sourceName").
SetInput(ingestion.SourceCommercetoolsAsSourceInput(
ingestion.NewEmptySourceCommercetools().SetStoreKeys(
[]string{"myStore"}).SetLocales(
[]string{
"de",
}).
SetUrl("http://commercetools.com").
SetProjectKey("keyID").SetProductQueryPredicate("masterVariant(attributes(name=\"Brand\" and value=\"Algolia\"))"))).
SetAuthenticationID("6c02aeb1-775e-418e-870b-1faccd4b2c0f"),
))
if err != nil {
// handle the eventual error
panic(err)
}
// print the response
print(response)
// Initialize the client
IngestionClient client = new IngestionClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY", "ALGOLIA_APPLICATION_REGION");
// Call the API
SourceCreateResponse response = client.createSource(
new SourceCreate()
.setType(SourceType.COMMERCETOOLS)
.setName("sourceName")
.setInput(
new SourceCommercetools()
.setStoreKeys(Arrays.asList("myStore"))
.setLocales(Arrays.asList("de"))
.setUrl("http://commercetools.com")
.setProjectKey("keyID")
.setProductQueryPredicate("masterVariant(attributes(name=\"Brand\" and value=\"Algolia\"))")
)
.setAuthenticationID("6c02aeb1-775e-418e-870b-1faccd4b2c0f")
);
// print the response
System.out.println(response);
// Initialize the client
// Replace 'us' with your Algolia Application Region
const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY').initIngestion({ region: 'us' });
// Call the API
const response = await client.createSource({
type: 'commercetools',
name: 'sourceName',
input: {
storeKeys: ['myStore'],
locales: ['de'],
url: 'http://commercetools.com',
projectKey: 'keyID',
productQueryPredicate: 'masterVariant(attributes(name="Brand" and value="Algolia"))',
},
authenticationID: '6c02aeb1-775e-418e-870b-1faccd4b2c0f',
});
// print the response
console.log(response);
// Initialize the client
val client =
IngestionClient(
appId = "ALGOLIA_APPLICATION_ID",
apiKey = "ALGOLIA_API_KEY",
region = "ALGOLIA_APPLICATION_REGION",
)
// Call the API
var response =
client.createSource(
sourceCreate =
SourceCreate(
type = SourceType.entries.first { it.value == "commercetools" },
name = "sourceName",
input =
SourceCommercetools(
storeKeys = listOf("myStore"),
locales = listOf("de"),
url = "http://commercetools.com",
projectKey = "keyID",
productQueryPredicate =
"masterVariant(attributes(name=\"Brand\" and value=\"Algolia\"))",
),
authenticationID = "6c02aeb1-775e-418e-870b-1faccd4b2c0f",
)
)
// print the response
println(response)
// Initialize the client
var client = new IngestionClient(
new IngestionConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY", "ALGOLIA_APPLICATION_REGION")
);
// Call the API
var response = await client.CreateSourceAsync(
new SourceCreate
{
Type = Enum.Parse<SourceType>("Commercetools"),
Name = "sourceName",
Input = new SourceInput(
new SourceCommercetools
{
StoreKeys = new List<string> { "myStore" },
Locales = new List<string> { "de" },
Url = "http://commercetools.com",
ProjectKey = "keyID",
ProductQueryPredicate =
"masterVariant(attributes(name=\"Brand\" and value=\"Algolia\"))",
}
),
AuthenticationID = "6c02aeb1-775e-418e-870b-1faccd4b2c0f",
}
);
// print the response
Console.WriteLine(response);
// Initialize the client
final client = IngestionClient(
appId: 'ALGOLIA_APPLICATION_ID',
apiKey: 'ALGOLIA_API_KEY',
region: 'ALGOLIA_APPLICATION_REGION');
// Call the API
final response = await client.createSource(
sourceCreate: SourceCreate(
type: SourceType.fromJson("commercetools"),
name: "sourceName",
input: SourceCommercetools(
storeKeys: [
"myStore",
],
locales: [
"de",
],
url: "http://commercetools.com",
projectKey: "keyID",
productQueryPredicate:
"masterVariant(attributes(name=\"Brand\" and value=\"Algolia\"))",
),
authenticationID: "6c02aeb1-775e-418e-870b-1faccd4b2c0f",
),
);
// print the response
print(response);
// Initialize the client with your application region, eg. ingestion.ALGOLIA_APPLICATION_REGION
client, err := ingestion.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY", ingestion.US)
if err != nil {
// The client can fail to initialize if you pass an invalid parameter.
panic(err)
}
// Call the API
response, err := client.CreateSource(client.NewApiCreateSourceRequest(
ingestion.NewEmptySourceCreate().
SetType(ingestion.SourceType("commercetools")).
SetName("sourceName").
SetInput(ingestion.SourceCommercetoolsAsSourceInput(
ingestion.NewEmptySourceCommercetools().SetStoreKeys(
[]string{"myStore"}).SetLocales(
[]string{
"de",
}).
SetUrl("http://commercetools.com").
SetProjectKey("keyID").SetProductQueryPredicate("masterVariant(attributes(name=\"Brand\" and value=\"Algolia\"))"))).
SetAuthenticationID("6c02aeb1-775e-418e-870b-1faccd4b2c0f"),
))
if err != nil {
// handle the eventual error
panic(err)
}
// print the response
print(response)
// Initialize the client
IngestionClient client = new IngestionClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY", "ALGOLIA_APPLICATION_REGION");
// Call the API
SourceCreateResponse response = client.createSource(
new SourceCreate()
.setType(SourceType.COMMERCETOOLS)
.setName("sourceName")
.setInput(
new SourceCommercetools()
.setStoreKeys(Arrays.asList("myStore"))
.setLocales(Arrays.asList("de"))
.setUrl("http://commercetools.com")
.setProjectKey("keyID")
.setProductQueryPredicate("masterVariant(attributes(name=\"Brand\" and value=\"Algolia\"))")
)
.setAuthenticationID("6c02aeb1-775e-418e-870b-1faccd4b2c0f")
);
// print the response
System.out.println(response);
// Initialize the client
// Replace 'us' with your Algolia Application Region
const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY').initIngestion({ region: 'us' });
// Call the API
const response = await client.createSource({
type: 'commercetools',
name: 'sourceName',
input: {
storeKeys: ['myStore'],
locales: ['de'],
url: 'http://commercetools.com',
projectKey: 'keyID',
productQueryPredicate: 'masterVariant(attributes(name="Brand" and value="Algolia"))',
},
authenticationID: '6c02aeb1-775e-418e-870b-1faccd4b2c0f',
});
// print the response
console.log(response);
// Initialize the client
val client =
IngestionClient(
appId = "ALGOLIA_APPLICATION_ID",
apiKey = "ALGOLIA_API_KEY",
region = "ALGOLIA_APPLICATION_REGION",
)
// Call the API
var response =
client.createSource(
sourceCreate =
SourceCreate(
type = SourceType.entries.first { it.value == "commercetools" },
name = "sourceName",
input =
SourceCommercetools(
storeKeys = listOf("myStore"),
locales = listOf("de"),
url = "http://commercetools.com",
projectKey = "keyID",
productQueryPredicate =
"masterVariant(attributes(name=\"Brand\" and value=\"Algolia\"))",
),
authenticationID = "6c02aeb1-775e-418e-870b-1faccd4b2c0f",
)
)
// print the response
println(response)
Your Algolia API key with the necessary permissions to make the request.
Permissions are controlled through access control lists (ACL) and access restrictions.
The required ACL to make a request is listed in each endpoint's reference.