Skip to content
Last updated

Checking Job Status in Norce Commerce Connect

This page provides examples and guidance for checking the status of asynchronous jobs in Norce Commerce Connect. Use these examples to monitor import progress, troubleshoot issues, and integrate job status checks into your workflows.

Overview

Norce Commerce Connect processes many operations asynchronously. When you submit an import or update, the API returns a job ID. You can use this job ID to check the status of your request, retrieve job details, or restart jobs if needed.

Example Resources

Using Client Libraries

Norce Commerce provides official client libraries for C#. These libraries simplify integration with the Connect API.

Common Job API Calls

Get Job Status

Use the Job/Get endpoint to retrieve information about a specific job by its job ID. The response includes a StatusId field, which indicates the job's current state:

  • 1 = Initialized
  • 2 = Succeeded
  • 3 = Failed
  • 4 = Validation failed

Example: Get Job Status in Postman

Example: Get Job Status in .NET

Click to expand .NET code example
// filepath: c:\Data\GitHub\docs.norce.io\developer-portal\system-integration\job-check-examples.md
// 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);
    }
}

List All Jobs

Use the Job/List endpoint to retrieve all jobs run since the last log cleanup.

Restart a Job

Use the Job/Restart endpoint to rerun a job using the original payload. This is mainly used for debugging or retrying failed jobs.

Health Check (Ping)

Use the Job/Ping endpoint to check the uptime status of the Norce Commerce Connect service.

Further Reading

Explore additional code examples and integration scenarios: