Skip to main content

Client library for the merge API

Project description

Merge Python Library

pypi fern shield

The Merge Python library provides access to the Merge API from Python.

Documentation

API reference documentation is available here.

Installation

pip install --upgrade MergePythonClient

Instantiation

import merge
from merge.client import Merge

client = Merge(api_key="Bearer YOUR_API_KEY", account_token="YOUR_ACCOUNT_TOKEN")

Categories

This SDK contains both the ATS, HRIS, CRM, Ticketing, and Accounting categories. Even if you do not plan on using more than one Merge API category right now, the SDK provides upgrade-flexibility in case you find new Merge API categories useful in the future.

Each category is namespaced:

client = Merge(api_key="Bearer YOUR_API_KEY")

client.ats. # APIs specific to the ATS Category

client.hris. # APIs specific to the HRIS Category

Usage

Create Link Token

import merge
from merge.client import Merge

merge_client = Merge(
    api_key="<YOUR_API_KEY>", 
    account_token="<YOUR_ACCOUNT_TOKEN>")

link_token_response = merge_client.ats.link_token.create(
    end_user_email_address="john.smith@gmail.com",
    end_user_organization_name="acme",
    end_user_origin_id="1234",
    categories=[CategoriesEnum.ATS],
    link_expiry_mins=30,
)

print("Created link token", link_token_response.link_token)

Get Employee

import merge
from merge.client import Merge

merge_client = Merge(
    api_key="<YOUR_API_KEY>", 
    account_token="<YOUR_ACCOUNT_TOKEN>")

employee = merge_client.hris.employees.retrieve(
    id="0958cbc6-6040-430a-848e-aafacbadf4ae")

Get Candidate

import merge
from merge.client import Merge

merge_client = Merge(
    api_key="<YOUR_API_KEY>", 
    account_token="<YOUR_ACCOUNT_TOKEN>")

candidate = merge_client.ats.candiates.retrieve(
    id="521b18c2-4d01-4297-b451-19858d07c133")

Filter Candidate

import merge
from merge.client import Merge

merge_client = Merge(
    api_key="<YOUR_API_KEY>", 
    account_token="<YOUR_ACCOUNT_TOKEN>")

candidates_response = merge_client.ats.candidates.list(
    created_after="2030-01-01")

print(candidates_response.result)

Get Contact

import merge
from merge.client import Merge

merge_client = Merge(
    api_key="<YOUR_API_KEY>", 
    account_token="<YOUR_ACCOUNT_TOKEN>")

contact = merge_client.accounting.contacts.retrieve(
    id="c640b80b-fac9-409f-aa19-1f9221aec445")

Create Ticket

import merge
from merge.client import Merge

merge_client = Merge(
    api_key="<YOUR_API_KEY>", 
    account_token="<YOUR_ACCOUNT_TOKEN>")

merge_client.ticketing.tickets.create(
    model=merge.ticketing.TicketRequest(
        name="Please add more integrations",
        assignees=[
            "17a54124-287f-494d-965e-3c5b330c9a68"
        ],
        creator="3fa85f64-5717-4562-b3fc-2c963f66afa6",
        due_date="2022-10-11T00:00:00Z",
        status=merge.ticketing.TicketRequestStatus.OPEN,
    ))

Pagination

The SDK may return paginated results. Endpoints that return paginated results will include a next and prev property on the response. To get the next page, you can pass in the value of next to the cursor property on the request. Similarly, to get the previous page, you can pass in the value of prev to the cursor property on the request.

Below is an example of iterating over all pages:

# response contains the first page
response = merge_client.hris.employees.list(created_after="2030-01-01")

# if there is a next page, load it by passing `next` to the cursor argument
while response.next is not None:
    response = hris_client.employees.list(
        cursor=response.next, 
        created_after="2030-01-01")

Beta status

This SDK is in beta, and there may be breaking changes between versions without a major version update. Therefore, we recommend pinning the package version to a specific version in your package.json file. This way, you can install the same version each time without breaking changes unless you are intentionally looking for the latest version.

Contributing

While we value open-source contributions to this SDK, this library is generated programmatically. Additions made directly to this library would have to be moved over to our generation code, otherwise they would be overwritten upon the next generated release. Feel free to open a PR as a proof of concept, but know that we will not be able to merge it as-is. We suggest opening an issue first to discuss with us!

On the other hand, contributions to the README are always very welcome!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mergepythonclient-0.1.1.tar.gz (355.4 kB view details)

Uploaded Source

Built Distribution

mergepythonclient-0.1.1-py3-none-any.whl (960.0 kB view details)

Uploaded Python 3

File details

Details for the file mergepythonclient-0.1.1.tar.gz.

File metadata

  • Download URL: mergepythonclient-0.1.1.tar.gz
  • Upload date:
  • Size: 355.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.7.17 Linux/5.15.0-1041-azure

File hashes

Hashes for mergepythonclient-0.1.1.tar.gz
Algorithm Hash digest
SHA256 41313ce1b3f02da569af2fd8f1367f001439807f7829a38faa324c4a751ddac0
MD5 ee58da25d05da5e2e597f43aab36051b
BLAKE2b-256 286a5c988b45b2d4fc39f1d5262f0194b8d1309070a2398799ce5d45af1a82ce

See more details on using hashes here.

File details

Details for the file mergepythonclient-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: mergepythonclient-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 960.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.7.17 Linux/5.15.0-1041-azure

File hashes

Hashes for mergepythonclient-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 5f6c94c24d61fb2445cc92d96e1fd2313c35ba8740c4e87c5080749c59741121
MD5 d31078549f37793ec204a9a6237c053f
BLAKE2b-256 f3e673e4b04bb9f11436234979c6902b0dfc603f2f43a5295735ee25987fa64c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page