Go directly to our postman collection of examples:
- Norce Commerce Connect Job examples in postman
- Some .net code examples using our nuget package (see below)
Norce Commerce has client libraries for c#. Read more about them here:
- Norce Commerce code repositories (Github)
- Commerce Connect contracts and as a nuget
Job/Get is used to ask Norce Commerce about a certain job to get its information.
After an import request have been sent, you can call Norce Commerce Connect to view status of your job. The basic status to check is StatusId
, which translates as:
- 1 = Initialized
- 2 = Succeeded
- 3 = Failed
- 4 = Validation failed
Here is a code example using .net client library
//Using Storm Client library: https://github.com/StormCommerce/Storm.Connect.Contracts
//Nuget: https://www.nuget.org/packages/Enferno.Services.StormConnect.Contracts/
private static void Main()
{
var serviceUrl = "https://demo.api-se.norce.tech/commerce/connect/4.0/";
var applicationId = 0;
var secretKey = Guid.NewGuid();
// List details for specific job
var job = ImportMethod(serviceUrl, applicationId, secretKey);
// ...
// Recheck specific job to see updated status
var specificJob = GetJob(serviceUrl, applicationId, secretKey, job.JobId);
// List all jobs
var allJObs = GetJobs(serviceUrl, applicationId, secretKey);
}
public static JobDto GetJob(
string serviceUrl, int applicationId, Guid secretKey, int jobId)
{
using (var httpClient = new HttpClient())
{
var credentials =
Encoding.ASCII.GetBytes($"{applicationId}:{secretKey.ToString("D")}");
// Base64Encoded Basic authentication is used
var credentialsToBase64 = Convert.ToBase64String(credentials);
httpClient.DefaultRequestHeaders.Authorization =
new AuthenticationHeaderValue("Basic", credentialsToBase64);
var jobResponse = httpClient.GetStringAsync($"{serviceUrl}job/{jobId}").Result;
return JsonConvert.DeserializeObject<JobDto>(jobResponse);
}
}
public static List<JobDto> GetJobs(
string serviceUrl, int applicationId, Guid secretKey)
{
using (var httpClient = new HttpClient())
{
var credentials =
Encoding.ASCII.GetBytes($"{applicationId}:{secretKey.ToString("D")}");
// Base64Encoded Basic authentication is used
var credentialsToBase64 = Convert.ToBase64String(credentials);
httpClient.DefaultRequestHeaders.Authorization =
new AuthenticationHeaderValue("Basic", credentialsToBase64);
var allJobsResponse = httpClient.GetStringAsync($"{serviceUrl}job").Result;
return JsonConvert.DeserializeObject<List<JobDto>>(allJobsResponse);
}
}
Job/List lists all the jobs run since last log cleanup.
Job/Restart re-runs a job from the stored data already in Norce. Used mainly in debug scenarios.
Job/Ping does a system check. Used for checking uptime status of the Norce Commerce Connect service.
- Commerce Connect code examples
- Calling Commerce Connect
- Product and pricing integrations
- Supplier integrations
- Shopping integrations