# Job check examples ## Examples Go directly to our postman collection of examples: - [Norce Commerce Connect Job examples](https://documenter.getpostman.com/view/2973406/2sA35MzJve#87640e86-439e-4958-873d-0c126343a490) in postman - Some .net code examples using our nuget package (see below) ### Using client libraries Norce Commerce has client libraries for c#. Read more about them here: - [Norce Commerce code repositories](https://github.com/StormCommerce) (Github) - [Commerce Connect contracts](https://github.com/StormCommerce/Storm.Connect.Contracts) and as a [nuget](https://www.nuget.org/packages/Enferno.Services.StormConnect.Contracts) ## Common calls to Connect API ### Job/Get [Job/Get](/api-reference/connect/jobservice/openapi/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** #### Examples in Postman - [Job/Get example](https://documenter.getpostman.com/view/2973406/2sA35MzJve#83d38462-70a8-4f76-a452-a2c757f288cc) #### Examples in Client Libraries details summary Here is a code example using .net client library ```csharp //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(jobResponse); } } public static List 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>(allJobsResponse); } } ``` ### ListJobs [Job/List](/api-reference/connect/jobservice/openapi/job/list) lists all the jobs run since last log cleanup. #### Examples in Postman - [ListJobs example](https://documenter.getpostman.com/view/2973406/2sA35MzJve#936cf10a-f7f0-4d98-814d-19083815cb51) ### RestartJob [Job/Restart](/api-reference/connect/jobservice/openapi/job/restart) re-runs a job from the stored data already in Norce. Used mainly in debug scenarios. #### Examples in Postman - [RestartJob example](https://documenter.getpostman.com/view/2973406/2sA35MzJve#048acd10-d5ee-4a5f-b2dd-eb91520c3e4a) ### Ping [Job/Ping](/api-reference/connect/jobservice/openapi/healthcheck/ping) does a system check. Used for checking uptime status of the Norce Commerce Connect service. #### Examples in Postman - [Ping example](https://documenter.getpostman.com/view/2973406/2sA35MzJve#0431f7c2-e5cd-48d2-8692-645855f63a90) ## Suggested further reading - Commerce Connect code examples - Job (this) - [Product](/developer-portal/system-integration/product-integration-examples) - [Supplier](/developer-portal/system-integration/supplier-integration-examples) - [Customer](/developer-portal/system-integration/customer-integration-examples) - [Calling Commerce Connect](/developer-portal/system-integration/calling-norce-commerce-connect) - [Product and pricing integrations](/developer-portal/system-integration/products-and-pricing-integrations) - [Supplier integrations](/developer-portal/system-integration/supplier-integrations) - [Shopping integrations](/developer-portal/system-integration/shopping-integrations)