Skip to content

Latest commit

 

History

History
255 lines (184 loc) · 9.13 KB

File metadata and controls

255 lines (184 loc) · 9.13 KB

Jobs

(jobs())

Overview

Available Operations

  • cancelJob - Cancel a running Job
  • createJob - Trigger a sync or reset job of a connection
  • getJob - Get Job status and details
  • listJobs - List Jobs by sync type

cancelJob

Cancel a running Job

Example Usage

package hello.world;

import com.airbyte.api.Airbyte;
import com.airbyte.api.models.operations.CancelJobRequest;
import com.airbyte.api.models.operations.CancelJobResponse;
import com.airbyte.api.models.shared.SchemeBasicAuth;
import com.airbyte.api.models.shared.Security;
import java.lang.Exception;

public class Application {

    public static void main(String[] args) throws Exception {

        Airbyte sdk = Airbyte.builder()
                .security(Security.builder()
                    .basicAuth(SchemeBasicAuth.builder()
                        .password("")
                        .username("")
                        .build())
                    .build())
            .build();

        CancelJobRequest req = CancelJobRequest.builder()
                .jobId(801771L)
                .build();

        CancelJobResponse res = sdk.jobs().cancelJob()
                .request(req)
                .call();

        if (res.jobResponse().isPresent()) {
            // handle response
        }
    }
}

Parameters

Parameter Type Required Description
request CancelJobRequest ✔️ The request object to use for the request.

Response

CancelJobResponse

Errors

Error Type Status Code Content Type
models/errors/SDKError 4XX, 5XX */*

createJob

Trigger a sync or reset job of a connection

Example Usage

package hello.world;

import com.airbyte.api.Airbyte;
import com.airbyte.api.models.operations.CreateJobResponse;
import com.airbyte.api.models.shared.*;
import java.lang.Exception;

public class Application {

    public static void main(String[] args) throws Exception {

        Airbyte sdk = Airbyte.builder()
                .security(Security.builder()
                    .basicAuth(SchemeBasicAuth.builder()
                        .password("")
                        .username("")
                        .build())
                    .build())
            .build();

        JobCreateRequest req = JobCreateRequest.builder()
                .connectionId("e735894a-e773-4938-969f-45f53957b75b")
                .jobType(JobTypeEnum.SYNC)
                .build();

        CreateJobResponse res = sdk.jobs().createJob()
                .request(req)
                .call();

        if (res.jobResponse().isPresent()) {
            // handle response
        }
    }
}

Parameters

Parameter Type Required Description
request JobCreateRequest ✔️ The request object to use for the request.

Response

CreateJobResponse

Errors

Error Type Status Code Content Type
models/errors/SDKError 4XX, 5XX */*

getJob

Get Job status and details

Example Usage

package hello.world;

import com.airbyte.api.Airbyte;
import com.airbyte.api.models.operations.GetJobRequest;
import com.airbyte.api.models.operations.GetJobResponse;
import com.airbyte.api.models.shared.SchemeBasicAuth;
import com.airbyte.api.models.shared.Security;
import java.lang.Exception;

public class Application {

    public static void main(String[] args) throws Exception {

        Airbyte sdk = Airbyte.builder()
                .security(Security.builder()
                    .basicAuth(SchemeBasicAuth.builder()
                        .password("")
                        .username("")
                        .build())
                    .build())
            .build();

        GetJobRequest req = GetJobRequest.builder()
                .jobId(131101L)
                .build();

        GetJobResponse res = sdk.jobs().getJob()
                .request(req)
                .call();

        if (res.jobResponse().isPresent()) {
            // handle response
        }
    }
}

Parameters

Parameter Type Required Description
request GetJobRequest ✔️ The request object to use for the request.

Response

GetJobResponse

Errors

Error Type Status Code Content Type
models/errors/SDKError 4XX, 5XX */*

listJobs

List Jobs by sync type

Example Usage

package hello.world;

import com.airbyte.api.Airbyte;
import com.airbyte.api.models.operations.ListJobsRequest;
import com.airbyte.api.models.operations.ListJobsResponse;
import com.airbyte.api.models.shared.SchemeBasicAuth;
import com.airbyte.api.models.shared.Security;
import java.lang.Exception;
import java.time.OffsetDateTime;

public class Application {

    public static void main(String[] args) throws Exception {

        Airbyte sdk = Airbyte.builder()
                .security(Security.builder()
                    .basicAuth(SchemeBasicAuth.builder()
                        .password("")
                        .username("")
                        .build())
                    .build())
            .build();

        ListJobsRequest req = ListJobsRequest.builder()
                .createdAtEnd(OffsetDateTime.parse("1687450500000"))
                .createdAtStart(OffsetDateTime.parse("1687450500000"))
                .orderBy("updatedAt|DESC")
                .updatedAtEnd(OffsetDateTime.parse("1687450500000"))
                .updatedAtStart(OffsetDateTime.parse("1687450500000"))
                .build();

        ListJobsResponse res = sdk.jobs().listJobs()
                .request(req)
                .call();

        if (res.jobsResponse().isPresent()) {
            // handle response
        }
    }
}

Parameters

Parameter Type Required Description
request ListJobsRequest ✔️ The request object to use for the request.

Response

ListJobsResponse

Errors

Error Type Status Code Content Type
models/errors/SDKError 4XX, 5XX */*