Giter Club home page Giter Club logo

freshworks-api-sdk's Introduction

Freshworks API SDK

Node.js SDK for working with Freshworks HTTP APIs. Currently supports Freshteam and partially supports Freshservice.

Installation

npm install --save @freshworks/api-sdk

Supported product APIs

Product Status
Freshteam โœ…
Freshservice ๐Ÿ

๐Ÿ - Partially supported services

Get started

This section depicts example of using different API capabilities offered with examples

Freshteam

This section depicts example of interacting with Freshteam API

const { Freshteam } = require("@freshworks/api-sdk");

const ft = new Freshteam(domain, apiKey);

Call a method, e.g., list all employees (who match a search criteria):

const res = await ft.employees.list({ first_name: "Arthur", last_name: "Dent" });
// Access the response body as an Array of `Employee` objects
const employees = res.json();

Freshservice

This section depicts example of interacting with Freshservice API

const { Freshservice } = require("@freshworks/api-sdk");

const fs = new Freshservice(domain, apiKey);

Call a method, e.g., fetch a Freshservice Ticket

// Get a tick with given ticket ID
const res = await fs.tickets.get(14000239432);
// Access the response body as a `Ticket` object
const ticket = res.json();

Documentation


License

MIT

freshworks-api-sdk's People

Contributors

dependabot[bot] avatar ravirajsubramanian avatar teja-kummarikuntla avatar thakurganeshsinghfw avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

baecentral

freshworks-api-sdk's Issues

Pagination query params for some GET endpoints not included in OpenAPI spec

Pagination query params, sort, sort_type, and page are not documented in the Freshteam OpenAPI spec, though pagination is supported on these endpoints:

  • GET /job_postings: ft.jobPostings.list()
  • GET /time_offs: ft.timeOffs.list()

Which means, codegen does not generate query params for pagination for their respective methods. Which means their respective methods in the API SDK cannot support pagination. :-|

Remove Vuepress

Vuepress is resulting in a lot of security vulnerabilities because of its transient dependencies, even though it is only a dev dependency. We should move away from Vuepress and maybe work towards a unified doc.

Generate code to use original casing for REST API query parameters

Currently, query parameters and model properties use camelCase, while the REST APIs use snake_case.

Keeping consistent case style will mean we can directly refer to API Reference documentation to use with query methods.

This will also impact all model conventions, which means we will have to update existing examples.

This relates to #19, where the query parameters were converted to a different casing.

Pagination headers need to be returned from response of pagination-capable endpoints

I tried to use the API SDK for the first time in a data-sync use case, and I found that we need to be able to pass response headers back to the user. Currently, we ignore headers and just send the response data as objects.

But, consider this, when calling GET /employees, pagination details are sent using the response headers total-objects, total-pages and link (URL to the next page). So, if I am running a scheduled function that syncs the list of Freshteam employees to another system, then the scheduled function needs to remember the link or the total-pages value to fetch the next page.

Job Listing API fetches Trashed jobs

We are trying to list active jobs from our Freshteam account in our website. We have followed the instructions and are able to fetch jobs, but they are jobs which are in Trash..

If you see the API documentation, and specifically query parameters for the job listing, you see status - can be one of draft, published, internal, private, on_hold, closed. There is nodeleted query parameter - to filter by deleted != true

We raised a Support ticket with Freshteam #124126 12 days back. They said today

It is developed by the marketplace team. In this SDK there is no delete query param itself. So we request you to raise a support ticket in the developer community so that it will be handled by them. Or you can raise an issue in the GitHub repo:

Can we please add this? Here is the failing code snippet - pretty much from the documentation.

const { Freshteam } = require("@freshworks/api-sdk");

const ft = new Freshteam(`${process.env.FRESHTEAM_DOMAIN}.freshteam.com`, process.env.FRESHTEAM_API_KEY);

const getJobs = async () => {
    let obj = {
        status: ["published"]
    };
    try {
        const resp = await ft.jobPostings.list(obj);
        const jobs = await resp.json();
        console.log(jobs);
    } catch (err) {
        console.log(err);
    }
}
const allJobs = getJobs();

output.txt

trash

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.