(crm().leads())
List leads
package hello.world;
import com.apideck.unify.Apideck;
import com.apideck.unify.models.components.LeadsFilter;
import com.apideck.unify.models.components.LeadsSort;
import com.apideck.unify.models.components.LeadsSortBy;
import com.apideck.unify.models.components.SortDirection;
import com.apideck.unify.models.errors.BadRequestResponse;
import com.apideck.unify.models.errors.NotFoundResponse;
import com.apideck.unify.models.errors.PaymentRequiredResponse;
import com.apideck.unify.models.errors.UnauthorizedResponse;
import com.apideck.unify.models.errors.UnprocessableResponse;
import com.apideck.unify.models.operations.CrmLeadsAllRequest;
import com.apideck.unify.models.operations.CrmLeadsAllResponse;
import java.lang.Exception;
import java.util.Map;
public class Application {
public static void main(String[] args) throws BadRequestResponse, UnauthorizedResponse, PaymentRequiredResponse, NotFoundResponse, UnprocessableResponse, Exception {
Apideck sdk = Apideck.builder()
.apiKey("<YOUR_BEARER_TOKEN_HERE>")
.consumerId("test-consumer")
.appId("dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX")
.build();
CrmLeadsAllRequest req = CrmLeadsAllRequest.builder()
.serviceId("salesforce")
.filter(LeadsFilter.builder()
.name("Elon Musk")
.firstName("Elon")
.lastName("Musk")
.email("[email protected]")
.phoneNumber("1234567890")
.build())
.sort(LeadsSort.builder()
.by(LeadsSortBy.CREATED_AT)
.direction(SortDirection.DESC)
.build())
.passThrough(Map.ofEntries(
Map.entry("search", "San Francisco")))
.fields("id,updated_at")
.build();
CrmLeadsAllResponse res = sdk.crm().leads().list()
.request(req)
.call();
if (res.getLeadsResponse().isPresent()) {
// handle response
}
}
}
Parameter |
Type |
Required |
Description |
request |
CrmLeadsAllRequest |
✔️ |
The request object to use for the request. |
CrmLeadsAllResponse
Error Type |
Status Code |
Content Type |
models/errors/BadRequestResponse |
400 |
application/json |
models/errors/UnauthorizedResponse |
401 |
application/json |
models/errors/PaymentRequiredResponse |
402 |
application/json |
models/errors/NotFoundResponse |
404 |
application/json |
models/errors/UnprocessableResponse |
422 |
application/json |
models/errors/APIException |
4XX, 5XX |
*/* |
Create lead
package hello.world;
import com.apideck.unify.Apideck;
import com.apideck.unify.models.components.Address;
import com.apideck.unify.models.components.Currency;
import com.apideck.unify.models.components.CustomField;
import com.apideck.unify.models.components.Email;
import com.apideck.unify.models.components.EmailType;
import com.apideck.unify.models.components.ExtendPaths;
import com.apideck.unify.models.components.Four;
import com.apideck.unify.models.components.LeadInput;
import com.apideck.unify.models.components.PassThroughBody;
import com.apideck.unify.models.components.PhoneNumber;
import com.apideck.unify.models.components.PhoneNumberType;
import com.apideck.unify.models.components.SocialLink;
import com.apideck.unify.models.components.Type;
import com.apideck.unify.models.components.Value;
import com.apideck.unify.models.components.Website;
import com.apideck.unify.models.components.WebsiteType;
import com.apideck.unify.models.errors.BadRequestResponse;
import com.apideck.unify.models.errors.NotFoundResponse;
import com.apideck.unify.models.errors.PaymentRequiredResponse;
import com.apideck.unify.models.errors.UnauthorizedResponse;
import com.apideck.unify.models.errors.UnprocessableResponse;
import com.apideck.unify.models.operations.CrmLeadsAddRequest;
import com.apideck.unify.models.operations.CrmLeadsAddResponse;
import java.lang.Exception;
import java.util.List;
import java.util.Map;
public class Application {
public static void main(String[] args) throws BadRequestResponse, UnauthorizedResponse, PaymentRequiredResponse, NotFoundResponse, UnprocessableResponse, Exception {
Apideck sdk = Apideck.builder()
.apiKey("<YOUR_BEARER_TOKEN_HERE>")
.consumerId("test-consumer")
.appId("dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX")
.build();
CrmLeadsAddRequest req = CrmLeadsAddRequest.builder()
.lead(LeadInput.builder()
.name("Elon Musk")
.companyName("Spacex")
.ownerId("54321")
.ownerName("John Doe")
.companyId("2")
.leadId("2")
.leadSource("Cold Call")
.firstName("Elon")
.lastName("Musk")
.description("A thinker")
.prefix("Sir")
.title("CEO")
.language("EN")
.status("New")
.monetaryAmount(75000d)
.currency(Currency.USD)
.fax("+12129876543")
.websites(List.of(
Website.builder()
.url("http://example.com")
.id("12345")
.type(WebsiteType.PRIMARY)
.build()))
.addresses(List.of(
Address.builder()
.id("123")
.type(Type.PRIMARY)
.string("25 Spring Street, Blackburn, VIC 3130")
.name("HQ US")
.line1("Main street")
.line2("apt #")
.line3("Suite #")
.line4("delivery instructions")
.streetNumber("25")
.city("San Francisco")
.state("CA")
.postalCode("94104")
.country("US")
.latitude("40.759211")
.longitude("-73.984638")
.county("Santa Clara")
.contactName("Elon Musk")
.salutation("Mr")
.phoneNumber("111-111-1111")
.fax("122-111-1111")
.email("[email protected]")
.website("https://elonmusk.com")
.notes("Address notes or delivery instructions.")
.rowVersion("1-12345")
.build(),
Address.builder()
.id("123")
.type(Type.PRIMARY)
.string("25 Spring Street, Blackburn, VIC 3130")
.name("HQ US")
.line1("Main street")
.line2("apt #")
.line3("Suite #")
.line4("delivery instructions")
.streetNumber("25")
.city("San Francisco")
.state("CA")
.postalCode("94104")
.country("US")
.latitude("40.759211")
.longitude("-73.984638")
.county("Santa Clara")
.contactName("Elon Musk")
.salutation("Mr")
.phoneNumber("111-111-1111")
.fax("122-111-1111")
.email("[email protected]")
.website("https://elonmusk.com")
.notes("Address notes or delivery instructions.")
.rowVersion("1-12345")
.build()))
.socialLinks(List.of(
SocialLink.builder()
.url("https://www.twitter.com/apideck")
.id("12345")
.type("twitter")
.build()))
.phoneNumbers(List.of(
PhoneNumber.builder()
.number("111-111-1111")
.id("12345")
.countryCode("1")
.areaCode("323")
.extension("105")
.type(PhoneNumberType.PRIMARY)
.build()))
.emails(List.of(
Email.builder()
.email("[email protected]")
.id("123")
.type(EmailType.PRIMARY)
.build()))
.customFields(List.of(
CustomField.builder()
.id("2389328923893298")
.name("employee_level")
.description("Employee Level")
.value(Value.of(Four.builder()
.build()))
.build(),
CustomField.builder()
.id("2389328923893298")
.name("employee_level")
.description("Employee Level")
.value(Value.of(10d))
.build(),
CustomField.builder()
.id("2389328923893298")
.name("employee_level")
.description("Employee Level")
.value(Value.of("Uses Salesforce and Marketo"))
.build()))
.tags(List.of(
"New"))
.passThrough(List.of(
PassThroughBody.builder()
.serviceId("<id>")
.extendPaths(List.of(
ExtendPaths.builder()
.path("$.nested.property")
.value(Map.ofEntries(\n Map.entry("TaxClassificationRef", Map.ofEntries(\n Map.entry("value", "EUC-99990201-V1-00020000")))))
.build(),
ExtendPaths.builder()
.path("$.nested.property")
.value(Map.ofEntries(\n Map.entry("TaxClassificationRef", Map.ofEntries(\n Map.entry("value", "EUC-99990201-V1-00020000")))))
.build(),
ExtendPaths.builder()
.path("$.nested.property")
.value(Map.ofEntries(\n Map.entry("TaxClassificationRef", Map.ofEntries(\n Map.entry("value", "EUC-99990201-V1-00020000")))))
.build()))
.build(),
PassThroughBody.builder()
.serviceId("<id>")
.extendPaths(List.of(
ExtendPaths.builder()
.path("$.nested.property")
.value(Map.ofEntries(\n Map.entry("TaxClassificationRef", Map.ofEntries(\n Map.entry("value", "EUC-99990201-V1-00020000")))))
.build(),
ExtendPaths.builder()
.path("$.nested.property")
.value(Map.ofEntries(\n Map.entry("TaxClassificationRef", Map.ofEntries(\n Map.entry("value", "EUC-99990201-V1-00020000")))))
.build()))
.build(),
PassThroughBody.builder()
.serviceId("<id>")
.extendPaths(List.of(
ExtendPaths.builder()
.path("$.nested.property")
.value(Map.ofEntries(\n Map.entry("TaxClassificationRef", Map.ofEntries(\n Map.entry("value", "EUC-99990201-V1-00020000")))))
.build(),
ExtendPaths.builder()
.path("$.nested.property")
.value(Map.ofEntries(\n Map.entry("TaxClassificationRef", Map.ofEntries(\n Map.entry("value", "EUC-99990201-V1-00020000")))))
.build(),
ExtendPaths.builder()
.path("$.nested.property")
.value(Map.ofEntries(\n Map.entry("TaxClassificationRef", Map.ofEntries(\n Map.entry("value", "EUC-99990201-V1-00020000")))))
.build()))
.build()))
.build())
.serviceId("salesforce")
.build();
CrmLeadsAddResponse res = sdk.crm().leads().create()
.request(req)
.call();
if (res.createLeadResponse().isPresent()) {
// handle response
}
}
}
Parameter |
Type |
Required |
Description |
request |
CrmLeadsAddRequest |
✔️ |
The request object to use for the request. |
CrmLeadsAddResponse
Error Type |
Status Code |
Content Type |
models/errors/BadRequestResponse |
400 |
application/json |
models/errors/UnauthorizedResponse |
401 |
application/json |
models/errors/PaymentRequiredResponse |
402 |
application/json |
models/errors/NotFoundResponse |
404 |
application/json |
models/errors/UnprocessableResponse |
422 |
application/json |
models/errors/APIException |
4XX, 5XX |
*/* |
Get lead
package hello.world;
import com.apideck.unify.Apideck;
import com.apideck.unify.models.errors.BadRequestResponse;
import com.apideck.unify.models.errors.NotFoundResponse;
import com.apideck.unify.models.errors.PaymentRequiredResponse;
import com.apideck.unify.models.errors.UnauthorizedResponse;
import com.apideck.unify.models.errors.UnprocessableResponse;
import com.apideck.unify.models.operations.CrmLeadsOneRequest;
import com.apideck.unify.models.operations.CrmLeadsOneResponse;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws BadRequestResponse, UnauthorizedResponse, PaymentRequiredResponse, NotFoundResponse, UnprocessableResponse, Exception {
Apideck sdk = Apideck.builder()
.apiKey("<YOUR_BEARER_TOKEN_HERE>")
.consumerId("test-consumer")
.appId("dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX")
.build();
CrmLeadsOneRequest req = CrmLeadsOneRequest.builder()
.id("<id>")
.serviceId("salesforce")
.fields("id,updated_at")
.build();
CrmLeadsOneResponse res = sdk.crm().leads().get()
.request(req)
.call();
if (res.getLeadResponse().isPresent()) {
// handle response
}
}
}
Parameter |
Type |
Required |
Description |
request |
CrmLeadsOneRequest |
✔️ |
The request object to use for the request. |
CrmLeadsOneResponse
Error Type |
Status Code |
Content Type |
models/errors/BadRequestResponse |
400 |
application/json |
models/errors/UnauthorizedResponse |
401 |
application/json |
models/errors/PaymentRequiredResponse |
402 |
application/json |
models/errors/NotFoundResponse |
404 |
application/json |
models/errors/UnprocessableResponse |
422 |
application/json |
models/errors/APIException |
4XX, 5XX |
*/* |
Update lead
package hello.world;
import com.apideck.unify.Apideck;
import com.apideck.unify.models.components.Address;
import com.apideck.unify.models.components.Currency;
import com.apideck.unify.models.components.CustomField;
import com.apideck.unify.models.components.Email;
import com.apideck.unify.models.components.EmailType;
import com.apideck.unify.models.components.ExtendPaths;
import com.apideck.unify.models.components.Four;
import com.apideck.unify.models.components.LeadInput;
import com.apideck.unify.models.components.PassThroughBody;
import com.apideck.unify.models.components.PhoneNumber;
import com.apideck.unify.models.components.PhoneNumberType;
import com.apideck.unify.models.components.SocialLink;
import com.apideck.unify.models.components.Type;
import com.apideck.unify.models.components.Value;
import com.apideck.unify.models.components.Website;
import com.apideck.unify.models.components.WebsiteType;
import com.apideck.unify.models.errors.BadRequestResponse;
import com.apideck.unify.models.errors.NotFoundResponse;
import com.apideck.unify.models.errors.PaymentRequiredResponse;
import com.apideck.unify.models.errors.UnauthorizedResponse;
import com.apideck.unify.models.errors.UnprocessableResponse;
import com.apideck.unify.models.operations.CrmLeadsUpdateRequest;
import com.apideck.unify.models.operations.CrmLeadsUpdateResponse;
import java.lang.Exception;
import java.util.List;
import java.util.Map;
public class Application {
public static void main(String[] args) throws BadRequestResponse, UnauthorizedResponse, PaymentRequiredResponse, NotFoundResponse, UnprocessableResponse, Exception {
Apideck sdk = Apideck.builder()
.apiKey("<YOUR_BEARER_TOKEN_HERE>")
.consumerId("test-consumer")
.appId("dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX")
.build();
CrmLeadsUpdateRequest req = CrmLeadsUpdateRequest.builder()
.id("<id>")
.lead(LeadInput.builder()
.name("Elon Musk")
.companyName("Spacex")
.ownerId("54321")
.ownerName("John Doe")
.companyId("2")
.leadId("2")
.leadSource("Cold Call")
.firstName("Elon")
.lastName("Musk")
.description("A thinker")
.prefix("Sir")
.title("CEO")
.language("EN")
.status("New")
.monetaryAmount(75000d)
.currency(Currency.USD)
.fax("+12129876543")
.websites(List.of(
Website.builder()
.url("http://example.com")
.id("12345")
.type(WebsiteType.PRIMARY)
.build(),
Website.builder()
.url("http://example.com")
.id("12345")
.type(WebsiteType.PRIMARY)
.build(),
Website.builder()
.url("http://example.com")
.id("12345")
.type(WebsiteType.PRIMARY)
.build()))
.addresses(List.of(
Address.builder()
.id("123")
.type(Type.PRIMARY)
.string("25 Spring Street, Blackburn, VIC 3130")
.name("HQ US")
.line1("Main street")
.line2("apt #")
.line3("Suite #")
.line4("delivery instructions")
.streetNumber("25")
.city("San Francisco")
.state("CA")
.postalCode("94104")
.country("US")
.latitude("40.759211")
.longitude("-73.984638")
.county("Santa Clara")
.contactName("Elon Musk")
.salutation("Mr")
.phoneNumber("111-111-1111")
.fax("122-111-1111")
.email("[email protected]")
.website("https://elonmusk.com")
.notes("Address notes or delivery instructions.")
.rowVersion("1-12345")
.build(),
Address.builder()
.id("123")
.type(Type.PRIMARY)
.string("25 Spring Street, Blackburn, VIC 3130")
.name("HQ US")
.line1("Main street")
.line2("apt #")
.line3("Suite #")
.line4("delivery instructions")
.streetNumber("25")
.city("San Francisco")
.state("CA")
.postalCode("94104")
.country("US")
.latitude("40.759211")
.longitude("-73.984638")
.county("Santa Clara")
.contactName("Elon Musk")
.salutation("Mr")
.phoneNumber("111-111-1111")
.fax("122-111-1111")
.email("[email protected]")
.website("https://elonmusk.com")
.notes("Address notes or delivery instructions.")
.rowVersion("1-12345")
.build()))
.socialLinks(List.of(
SocialLink.builder()
.url("https://www.twitter.com/apideck")
.id("12345")
.type("twitter")
.build()))
.phoneNumbers(List.of(
PhoneNumber.builder()
.number("111-111-1111")
.id("12345")
.countryCode("1")
.areaCode("323")
.extension("105")
.type(PhoneNumberType.PRIMARY)
.build(),
PhoneNumber.builder()
.number("111-111-1111")
.id("12345")
.countryCode("1")
.areaCode("323")
.extension("105")
.type(PhoneNumberType.PRIMARY)
.build(),
PhoneNumber.builder()
.number("111-111-1111")
.id("12345")
.countryCode("1")
.areaCode("323")
.extension("105")
.type(PhoneNumberType.PRIMARY)
.build()))
.emails(List.of(
Email.builder()
.email("[email protected]")
.id("123")
.type(EmailType.PRIMARY)
.build(),
Email.builder()
.email("[email protected]")
.id("123")
.type(EmailType.PRIMARY)
.build()))
.customFields(List.of(
CustomField.builder()
.id("2389328923893298")
.name("employee_level")
.description("Employee Level")
.value(Value.of(Four.builder()
.build()))
.build()))
.tags(List.of(
"New"))
.passThrough(List.of(
PassThroughBody.builder()
.serviceId("<id>")
.extendPaths(List.of(
ExtendPaths.builder()
.path("$.nested.property")
.value(Map.ofEntries(\n Map.entry("TaxClassificationRef", Map.ofEntries(\n Map.entry("value", "EUC-99990201-V1-00020000")))))
.build()))
.build(),
PassThroughBody.builder()
.serviceId("<id>")
.extendPaths(List.of(
ExtendPaths.builder()
.path("$.nested.property")
.value(Map.ofEntries(\n Map.entry("TaxClassificationRef", Map.ofEntries(\n Map.entry("value", "EUC-99990201-V1-00020000")))))
.build()))
.build(),
PassThroughBody.builder()
.serviceId("<id>")
.extendPaths(List.of(
ExtendPaths.builder()
.path("$.nested.property")
.value(Map.ofEntries(\n Map.entry("TaxClassificationRef", Map.ofEntries(\n Map.entry("value", "EUC-99990201-V1-00020000")))))
.build()))
.build()))
.build())
.serviceId("salesforce")
.build();
CrmLeadsUpdateResponse res = sdk.crm().leads().update()
.request(req)
.call();
if (res.updateLeadResponse().isPresent()) {
// handle response
}
}
}
Parameter |
Type |
Required |
Description |
request |
CrmLeadsUpdateRequest |
✔️ |
The request object to use for the request. |
CrmLeadsUpdateResponse
Error Type |
Status Code |
Content Type |
models/errors/BadRequestResponse |
400 |
application/json |
models/errors/UnauthorizedResponse |
401 |
application/json |
models/errors/PaymentRequiredResponse |
402 |
application/json |
models/errors/NotFoundResponse |
404 |
application/json |
models/errors/UnprocessableResponse |
422 |
application/json |
models/errors/APIException |
4XX, 5XX |
*/* |
Delete lead
package hello.world;
import com.apideck.unify.Apideck;
import com.apideck.unify.models.errors.BadRequestResponse;
import com.apideck.unify.models.errors.NotFoundResponse;
import com.apideck.unify.models.errors.PaymentRequiredResponse;
import com.apideck.unify.models.errors.UnauthorizedResponse;
import com.apideck.unify.models.errors.UnprocessableResponse;
import com.apideck.unify.models.operations.CrmLeadsDeleteRequest;
import com.apideck.unify.models.operations.CrmLeadsDeleteResponse;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws BadRequestResponse, UnauthorizedResponse, PaymentRequiredResponse, NotFoundResponse, UnprocessableResponse, Exception {
Apideck sdk = Apideck.builder()
.apiKey("<YOUR_BEARER_TOKEN_HERE>")
.consumerId("test-consumer")
.appId("dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX")
.build();
CrmLeadsDeleteRequest req = CrmLeadsDeleteRequest.builder()
.id("<id>")
.serviceId("salesforce")
.build();
CrmLeadsDeleteResponse res = sdk.crm().leads().delete()
.request(req)
.call();
if (res.deleteLeadResponse().isPresent()) {
// handle response
}
}
}
Parameter |
Type |
Required |
Description |
request |
CrmLeadsDeleteRequest |
✔️ |
The request object to use for the request. |
CrmLeadsDeleteResponse
Error Type |
Status Code |
Content Type |
models/errors/BadRequestResponse |
400 |
application/json |
models/errors/UnauthorizedResponse |
401 |
application/json |
models/errors/PaymentRequiredResponse |
402 |
application/json |
models/errors/NotFoundResponse |
404 |
application/json |
models/errors/UnprocessableResponse |
422 |
application/json |
models/errors/APIException |
4XX, 5XX |
*/* |