addObject, deleteIndex, editSettings
Usage
// 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
$client = IngestionClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY', 'ALGOLIA_APPLICATION_REGION');
// Call the API
$response = $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
var_dump($response);
# Initialize the client
# In an asynchronous context, you can use IngestionClient instead, which exposes the exact same methods.
client = IngestionClientSync(
"ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY", "ALGOLIA_APPLICATION_REGION"
)
# Call the API
response = client.create_source(
source_create={
"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
print(response)
# Initialize the client
client = Algolia::IngestionClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY", "ALGOLIA_APPLICATION_REGION")
# Call the API
response = client.create_source(
Algolia::Ingestion::SourceCreate.new(
type: "commercetools",
name: "sourceName",
input: Algolia::Ingestion::SourceCommercetools.new(
store_keys: ["myStore"],
locales: ["de"],
url: "http://commercetools.com",
project_key: "keyID",
product_query_predicate: "masterVariant(attributes(name=\"Brand\" and value=\"Algolia\"))"
),
authentication_id: "6c02aeb1-775e-418e-870b-1faccd4b2c0f"
)
)
# print the response
puts(response)
// Initialize the client
val client = IngestionClient(
appId = "ALGOLIA_APPLICATION_ID",
apiKey = "ALGOLIA_API_KEY",
region = "ALGOLIA_APPLICATION_REGION"
)
// Call the API
val response = Await.result(
client.createSource(
sourceCreate = SourceCreate(
`type` = SourceType.withName("commercetools"),
name = "sourceName",
input = Some(
SourceCommercetools(
storeKeys = Some(Seq("myStore")),
locales = Some(Seq("de")),
url = "http://commercetools.com",
projectKey = "keyID",
productQueryPredicate = Some("masterVariant(attributes(name=\"Brand\" and value=\"Algolia\"))")
)
),
authenticationID = Some("6c02aeb1-775e-418e-870b-1faccd4b2c0f")
)
),
Duration(100, "sec")
)
// print the response
println(response)
// Initialize the client
let client = try IngestionClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY", region: .us)
// Call the API
let response = try await client.createSource(sourceCreate: SourceCreate(
type: SourceType.commercetools,
name: "sourceName",
input: SourceInput.sourceCommercetools(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)
See the full API reference
For more details about input parameters
and response fields.