merge-api / merge-java-client Goto Github PK
View Code? Open in Web Editor NEWThe JVM SDK for accessing various Merge Unified APIs
License: Other
The JVM SDK for accessing various Merge Unified APIs
License: Other
linkToken
creation api fails saying that accessToken
is required. This is a regression from v1.0.5
where this was not an issue. Now we cannot create new linked accounts in the new version and we had to revert
There was an option/method to fetch employees with extended option and get the extended employee data from the merge.dev (legacy java sdk), that is not in the new java client, is there a plan to support that or is it officially removed/deprecated?
According to Merge's documentation, there is a way of fetching a category agnostic link token from this endpoint: https://api.merge.dev/api/integrations/create-link-token
In this SDK, it seems that you are forced to select a category specific client client (ats()
, accounting()
, etc.) in order to fetch a link token. E.g. From the README:
LinkToken linkToken = mergeClient.ats().linkToken().create(EndUserDetailsRequest.builder()
.endUserEmailAddress("[email protected]")
.endUserOrganizationName("acme")
.endUserOriginId("1234")
.categories(List.of(CategoriesEnum.ATS))
.build());
And that link token is fetched from a different endpoint: <base_url>api/ats/v1/link-token
Is there a way to fetch a category agnostic link token so that Merge Link can be powered? Otherwise we would have to create custom UI to figure out what category the user would like to create the link for, then fetch the link token for that category, then use that to power Merge Link.
Ideally we would fetch a link token that's not tied to a category, and use that to power the Merge Link UI component without going through the first step.
I'm testing the SDK in my Kotlin project, like so
val result = mergeApiClient.hris().employees().list(
EmployeesListRequest.builder().build(),
RequestOptions.builder()
.accountToken("token-here")
.build()
)
When I run this, I encounter the following error
java.lang.NullPointerException: Cannot invoke "java.util.Optional.isPresent()" because the return value of "com.merge.api.core.RequestOptions.getTimeout()" is null
at com.merge.api.resources.hris.employees.EmployeesClient.list(EmployeesClient.java:183)
I believe that this can be fixed if the default value for timeout
in RequestOptions
is changed from null
to Optional.empty()
We're attempting to migrate to this SDK version, but creating a comment doesn't seem to be working correctly.
Here's the snippet of code (Kotlin) we're using to perform this action:
// ticketId - the ticket to make a comment for
// customerAccountToken - specific merge account token for a specific install
// vendorMarkdownCommentBody - markdown that the ticketing vendor accept and displays nicely
val mergeClient = MergeApiClient.builder().apiKey(properties.apiKey).build()
val ticketingClient = mergeClient.ticketing()
val ticketsClient = ticketingClient.tickets()
val existingTicket = ticketsClient.retrieve(
ticketId, TicketsRetrieveRequest.builder().build(),
RequestOptions.builder().accountToken(customerAccountToken).build()
)
val commentsClient = ticketingClient.comments()
val createCommentRequest =
CommentEndpointRequest.builder()
.model(
CommentRequest.builder()
// pass back in the whole 'existingTicket' object - `tags` is an (empty) array of string on this `Ticket` object
.ticket(CommentRequestTicket.of(existingTicket))
.body(vendorMarkdownCommentBody)
.build())
.build()
// this blows up with a 400 from us to merge.
val createdComment = commentsClient.create(
createCommentRequest,
RequestOptions.builder().accountToken(customerAccountToken).build()
)
Here's the request / response that is being generated and received.
Request:
{
"model": {
"body": "<!-- truncated, string -->",
"ticket": {
"id": "<uuid>",
"remote_id": "<remote_id>",
"name": "<!-- truncated, string -->",
"assignees": [],
"status": "OPEN",
"description": "<!-- truncated, string -->",
"collections": [
"<uuid>"
],
"ticket_type": "Issue",
"attachments": [],
"tags": [],
"remote_created_at": "2024-02-01T23:32:42.307Z",
"remote_updated_at": "2024-02-01T23:32:42.307Z",
"remote_was_deleted": false,
"ticket_url": "<!-- truncated, string -->",
"created_at": "2024-02-01T23:32:41.877615Z",
"modified_at": "2024-02-01T23:32:42.441999Z"
}
}
}
Response:
{
"warnings": [],
"errors": [
{
"source": {
"pointer": "model/ticket/tags"
},
"title": "Incorrect Field Type",
"detail": "Incorrect type for tags - expected type string, but got type array",
"problem_type": "INCORRECT_FIELD_TYPE"
}
]
}
From the SDK, tags is an empty array, so, either the API needs to accept the empty array, or the SDK needs to stringify? the array / or not send for this request?
When accessing a candidate list from Postman,
GET https://api.merge.dev/api/ats/v1/candidates?created_after=1953-11-23T13:06:29.055Z
I receive a full candidate list. However when accessing through the merge-java-client using the same API call I get an exception.
Exception in thread "main" java.lang.NoSuchFieldError: READ_UNKNOWN_ENUM_VALUES_USING_DEFAULT_VALUE
at com.fasterxml.jackson.databind.deser.std.EnumDeserializer.createContextual(EnumDeserializer.java:211)
at com.fasterxml.jackson.databind.DeserializationContext.handleSecondaryContextualization(DeserializationContext.java:867)
at com.fasterxml.jackson.databind.DeserializationContext.findRootValueDeserializer(DeserializationContext.java:659)
at com.fasterxml.jackson.databind.ObjectMapper._findRootDeserializer(ObjectMapper.java:4956)
at com.fasterxml.jackson.databind.ObjectMapper._convert(ObjectMapper.java:4537)
at com.fasterxml.jackson.databind.ObjectMapper.convertValue(ObjectMapper.java:4475)
at com.merge.api.resources.ats.types.PhoneNumberPhoneNumberType$Deserializer.deserialize(PhoneNumberPhoneNumberType.java:84)
at com.merge.api.resources.ats.types.PhoneNumberPhoneNumberType$Deserializer.deserialize(PhoneNumberPhoneNumberType.java:75)
at com.fasterxml.jackson.databind.deser.std.ReferenceTypeDeserializer.deserialize(ReferenceTypeDeserializer.java:204)
at com.fasterxml.jackson.databind.deser.impl.MethodProperty.deserializeSetAndReturn(MethodProperty.java:158)
at com.fasterxml.jackson.databind.deser.BuilderBasedDeserializer.vanillaDeserialize(BuilderBasedDeserializer.java:293)
at com.fasterxml.jackson.databind.deser.BuilderBasedDeserializer.deserialize(BuilderBasedDeserializer.java:217)
at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer._deserializeFromArray(CollectionDeserializer.java:359)
at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:244)
at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:28)
at com.fasterxml.jackson.databind.deser.std.ReferenceTypeDeserializer.deserialize(ReferenceTypeDeserializer.java:204)
at com.fasterxml.jackson.databind.deser.impl.MethodProperty.deserializeSetAndReturn(MethodProperty.java:158)
at com.fasterxml.jackson.databind.deser.BuilderBasedDeserializer.vanillaDeserialize(BuilderBasedDeserializer.java:293)
at com.fasterxml.jackson.databind.deser.BuilderBasedDeserializer.deserialize(BuilderBasedDeserializer.java:217)
at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer._deserializeFromArray(CollectionDeserializer.java:359)
at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:244)
at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:28)
at com.fasterxml.jackson.databind.deser.std.ReferenceTypeDeserializer.deserialize(ReferenceTypeDeserializer.java:204)
at com.fasterxml.jackson.databind.deser.impl.MethodProperty.deserializeSetAndReturn(MethodProperty.java:158)
at com.fasterxml.jackson.databind.deser.BuilderBasedDeserializer.vanillaDeserialize(BuilderBasedDeserializer.java:293)
at com.fasterxml.jackson.databind.deser.BuilderBasedDeserializer.deserialize(BuilderBasedDeserializer.java:217)
at com.fasterxml.jackson.databind.deser.DefaultDeserializationContext.readRootValue(DefaultDeserializationContext.java:323)
at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:4825)
at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3772)
at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3740)
at com.merge.api.resources.ats.candidates.CandidatesClient.list(CandidatesClient.java:121)
at com.merge.api.resources.ats.candidates.CandidatesClient.list(CandidatesClient.java:48)
The distinct phone number types in the postman response were:
"phone_number_type": "OTHER"
"phone_number_type": "MOBILE"
The data used came from the Greeenhouse - Job Boards API
sample data.
The version of the client code is here:
<dependency>
<groupId>dev.merge</groupId>
<artifactId>merge-java-client</artifactId>
<version>1.0.8</version>
</dependency>
Using Client Java code:
mergeClient = MergeApiClient.builder()
.accountToken("TOKEN")
.apiKey("KEY")
.build();
candidateList = mergeClient.ats().candidates().list(
CandidatesListRequest.builder()
.createdAfter(OffsetDateTime.parse("2007-12-03T10:15:30+01:00"))
.build());
I was successful with this API call that returned valid data:
mergeClient = MergeApiClient.builder()
.accountToken("TOKEN")
.apiKey("KEY")
.build();
candidate = mergeClient.ats().candidates().retrieve(
"a3632d60-21d0-46ec-96b0-23cf233e668d",
CandidatesRetrieveRequest.builder()
.includeRemoteData(true)
.build());
Please help to fix the below issue asap. Refer the screenshots for more details, the order of the arguments are not matching with the RequestBody.create method.
In LinkTokenClient.java >> LineNo 45 >>
current code logic is as below:
body = RequestBody.create(
ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON);
expected code logic is as below:
body = RequestBody.create( MediaTypes.APPLICATION_JSON,
ObjectMappers.JSON_MAPPER.writeValueAsBytes(request));
Mvn Dependency:
<dependency>
<groupId>dev.merge</groupId>
<artifactId>merge-java-client</artifactId>
<version>1.0.8</version>
</dependency>
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.