0.1.0 • Published 9 months ago

jitbit-js v0.1.0

Weekly downloads
-
License
SEE LICENSE
Repository
github
Last release
9 months ago

jitbit-js

ZERO Dependencies Javascript Wrapper for the Jitbit REST API Built-in caching and exponential backoff retry logic.

.jitBit

Kind: static class
Date: November 15 2024 11:11 am -0500

new jitBit()

Class wrapper for jitbit rest api JITBIT Documentation https://www.jitbit.com/docs/api/

jitBit.getTickets(params, ignoreCache) ⇒ Array.<Object>

Get Tickets

Kind: instance method of jitBit
Returns: Array.<Object> - An Array of Ticket Objects, example below:
Date: November 13 2024 11:11 am -0500

ParamTypeDefaultDescription
paramsObject{}
params.modestring(optional) Allows you to choose, which tickets to show: all (default) shows all tickets, including closed, unanswered shows new or updated by customer or for tech tickets, unclosed all active tickets, handledbyme shows tickets assigned to the user
params.categoryIdArray.<int>(optional) Filter by a category, int or an Array of ints
params.sectionIdint(optional) Filter by a section
params.statusIdArray.<int>(optional) Filter by statusID(s), int or an Array of ints. "New" is 1, "In process" is 2 "Closed" is 3. Check your custom status IDs in the admin area
params.fromUserIdint(optional) Filter by a ticket creator
params.fromCompanyIdint(optional) Filter by a company
params.handledByUserIDint(optional) Filter by a ticket performer
params.tagNamestring(optional) Filter by ticket a tag
params.dateFromstring(optional) Filter by creation date (date format should be YYYY-MM-DD, for example 2016-11-24)
params.dateTostring(optional) Filter by creation date (date format should be YYYY-MM-DD, for example 2016-11-24)
params.updatedFromstring(optional) Filter by "last updated" date (date format should be YYYY-MM-DD, for example 2016-11-24)
params.updatedTostring(optional) Filter by "last updated" date (date format should be YYYY-MM-DD, for example 2016-11-24)
params.dueInDaysint(optional) Filter by "due in X days"
params.includeCustomFieldsbool(optional) Add custom field values to the output
params.subscribedOnlybool(optional) Only return tickets you are subscribed to
params.countint(optional) How many tickets to return. Default: 10. Max: 300.
params.offsetint(optional) Use this to create paging. For example "offset=20&count=20" will return the next 20 tickets after the first 20. Default: 0.
params.fullDetailsBoolean(optional) Will call "getTicket" for each record returned, so you'll get full ticket details instead of just a summary. This will slow down the API call significantly.
ignoreCacheBooleanIgnore Cache

Example

[
        {
        "IssueID": 382,
        "TicketID": 382,
        "Priority": 0,
        "StatusID": 1,
        "IssueDate": "2024-05-05T17:25:31.127Z",
        "Subject": "Test ticket",
        "Status": "In progress",
        "UpdatedByUser": false,
        "UpdatedByPerformer": false,
        "CategoryID": 21,
        "UserName": "admin",
        "Technician": null,
        "FirstName": "",
        "LastName": "",
        "DueDate": null,
        "TechFirstName": null,
        "TechLastName": null,
        "LastUpdated": "2024-05-06T10:24:13.873Z",
        "UpdatedForTechView": false,
        "UserID": 20,
        "CompanyID": null,
        "CompanyName": null,
        "AssignedToUserID": 1,
        "ResolvedDate": null,
        "SectionID": null,
        "Category": "test",
        "Origin": "WebApp",
        "Email": "admin@admin.lvm",
        "HasChildren": false,
        "LastUpdatedByUserID": 1,
        "LastUpdatedUsername": "",
        "StartDate": "2024-05-06T10:24:13.887Z"
        },
        //...more tickets
      ]

jitBit.getTicket(params, ignoreCache) ⇒ Object

get details of one specific ticket by ID

Kind: instance method of jitBit
Date: November 13 2024 12:11 pm -0500

ParamTypeDescription
paramsObject
params.idintTicket id
params.ticketIdint(Alias) Ticket id
params.issueIdint(Alias) Ticket id
params.IssueIDint(Alias) Ticket id
params.TicketIDint(Alias) Ticket id
ignoreCacheBooleanIgnore Cache

Example

{
        "Attachments": [
            {
                "FileName": "icon.png",
                "FileData": null,
                "FileID": 1740828,
                "CommentID": 12722431,
                "CommentDate": "2020-02-28T04:48:00Z",
                "FileHash": null,
                "FileSize": 0,
                "IssueID": 2431395,
                "UserID": 43499,
                "GoogleDriveUrl": null, //cloud URL (google, dropbox, onedrive etc)
                "ForTechsOnly": false,
                "Url": "https://support.jitbit.com/helpdesk/File/Get?id=1740828"
            }
        ],
        "Tags": [
            {
                "TagID": 14502,
                "Name": "tag1",
                "TagCount": 0
            }
        ],
        "Status": "In progress",
        "OnBehalfUserName": null,
        "SubmitterUserInfo": {
            "UserID": 43499,
            //more user info properties
        },
        "CategoryName": "General issues",
        "AssigneeUserInfo": {
            "UserID": 43499,
            //more user info properties
        },
        "TicketID": 2431395,
        "IssueID": 2431395,
        "UserID": 43499,
        "AssignedToUserID": 43499,
        "IssueDate": "2020-02-28T04:48:00Z",
        "Subject": "test",
        "Body": "test ticket",
        "Priority": 0,
        "StatusID": 2,
        "CategoryID": 7277,
        "DueDate": null,
        "ResolvedDate": null,
        "StartDate": "2020-02-28T04:48:00Z",
        "TimeSpentInSeconds": 143,
        "UpdatedByUser": false,
        "UpdatedByPerformer": true,
        "UpdatedForTechView": false,
        "IsCurrentUserTechInThisCategory": false,
        "IsCurrentCategoryForTechsOnly": false,
        "SubmittedByCurrentUser": true,
        "IsInKb": false,
        "Stats": null
      }

jitBit.deleteTicket(params)

delete ticket by ID

Kind: instance method of jitBit
Date: December 09 2024 11:11 pm -0500

ParamTypeDescription
paramsObject
params.idintTicket id
params.ticketIdint(Alias) Ticket id
params.issueIdint(Alias) Ticket id
params.IssueIDint(Alias) Ticket id
params.TicketIDint(Alias) Ticket id

jitBit.getAttachment(params) ⇒ Buffer

Allows you to download an individual file attachment

Kind: instance method of jitBit
Returns: Buffer - The requested file attachment as a file Buffer.
Date: November 13 2024 12:11 pm -0500

ParamTypeDescription
paramsObject
params.idintFile attachment ID
params.AttachmentIDint(Alias) File attachment ID
params.attachmentIdint(Alias) File attachment ID
params.fileIdint(Alias) File attachment ID
params.FileIDint(Alias) File attachment ID

jitBit.createTicket(params) ⇒ int

create a ticket

Kind: instance method of jitBit
Returns: int - returns the ticket ID if successful, otherwise null
Date: November 13 2024 12:11 pm -0500

ParamTypeDescription
paramsObject
params.categoryIdintCategory ID
params.bodystringTicket body
params.subjectstringTicket subject
params.priorityIdintTicket priority. Values: -1 – Low0 – Normal1 – High2 – Critical
params.userIdint(optional) - User-ID to create a ticket "on-behalf" of this user (requires technician permissions)
params.userUsernameint(optional) - User-Username to create a ticket "on-behalf" of this user (requires technician permissions)
params.userEmailint(optional) - User-Email to create a ticket "on-behalf" of this user (requires technician permissions)
params.tagsArray.<string>(optional) - An Array of tags as strings
params.originint(optional) - Where the ticket came from, i.e. sets the "via" field for the ticket. Can be one of: 0 (WebApp), 1 (Email), 2 (Widget), 3 (API), 4 (Scheduler), 5 (MobileApp), 6 (Phone), 7 (LiveChat), 8 (InPerson)
params.assignedToUserIdint(optional) - User-ID to assign the ticket to (optional, requires technician permissions)
params.assignedToUserUsernameint(optional) - User-Username to assign the ticket to (optional, requires technician permissions)
params.assignedToUserEmailint(optional) - User-Email to assign the ticket to (optional, requires technician permissions)
params.customFieldsObject(optional) - An object that contains custom field values for the ticket. Format { "ID1" : "value", "ID2" : "value" } where "ID" is the custom field's ID-number.
params.suppressConfirmationbool(optional) - Skip sending user confirmation email (useful when creating a ticket on behalf)
params.dryRunbool(optional) - looks up user and checks params, but does not create a ticket (no ticket id returned)

jitBit.getUser(params) ⇒ Object

lookup User, first result by userId, username, or email

Kind: instance method of jitBit
Returns: Object - returns User Details
Date: December 04 2024 12:11 pm -0500

ParamTypeDescription
paramsObject
params.userIdint(optional) - User-ID
params.usernameString(optional) - User's username
params.emailString(optional) - User's email address

Example

{
      "UserID": 43499,
      "Username": "Max",
      "Password": null,
      "Email": "max@test",
      "FirstName": "Max",
      "LastName": "",
      "Notes": "test",
      "Location": "",
      "Phone": "+16463977708",
      "Department": null,
      "CompanyName": "Jitbit Software",
      "IPAddress": "213.229.75.25",
      "HostName": "213.229.75.25",
      "Lang": "en-US",
      "UserAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.118 Safari/537.36",
      "AvatarURL": null,
      "Signature": "Cheers,\r\nMax",
      "Greeting": "Hi #FirstName#",
      "CompanyId": 451,
      "CompanyNotes": null,
      "IsAdmin": true,
      "Disabled": false,
      "SendEmail": false,
      "IsTech": false,
      "LastSeen": "2020-02-28T04:48:00Z",
      "IsManager": false,
      "PushToken": null,
      "FullNameAndLogin": "Max",
      "FullName": "Max"
    }

jitBit.updateTicket(params) ⇒ Boolean

update one or more tickets

Kind: instance method of jitBit
Returns: Boolean - true if status is 200, otherwise false
Date: November 13 2024 12:11 pm -0500

ParamTypeDescription
paramsObject
params.idintTicket ID
params.categoryIdint(optional) Ticket category
params.priorityint(optional) Ticket priority. Values: -1 Low, 0 Normal, 1 High, 2 Critical
params.dateDateTime(optional) Ticket creation date
params.userIdint(optional) Ticket submitter's user ID
params.dueDateDateTime(optional) Due date
params.assignedUserIdint(optional) Assigned technician's ID. Set to 0 (zero) to remove the currently assigned user.
params.timeSpentInSecondsint(optional) Time spent on the ticket
params.statusIdint(optional) Ticket status ID. "Closed" id 3, "New" is 1, "In process" is 2. Check your custom status IDs in the admin area
params.tagsstring(optional) A comma-separated list of tags to apply to the ticket. Like tags=tag1,tag2,tag3. All existing tags will be removed
params.subjectstring(optional) Ticket subject
params.bodystring(optional) Ticket body

jitBit.getCategories() ⇒ Array.<Object>

get all Categories

Kind: instance method of jitBit
Returns: Array.<Object> - Returns all categories the user has permissions to see
Date: December 02 2024 15:50 pm -0500
Example

[
        {
            "CategoryID": 7277,
            "Name": "General issues",
            "SectionID": null,
            "Section": null,
            "NameWithSection": "General issues",
            "ForTechsOnly": false,
            "FromAddress": null
        }
      ]

jitBit.jitBit

Kind: static class of jitBit
Date: November 15 2024 11:11 am -0500

new jitBit(params)

Creates an instance of jitBit.

ParamTypeDescription
paramsObject
params.baseUrlStringUsually something like http://{DOMAIN}/helpdesk/api
params.usernameStringusername for authentication (optional if token is provided)
params.passwordStringpassword for authentication (optional if token is provided)
params.tokenStringtoken for authentication (optional if username/password is provided) (You can get your token by visiting /User/Token/ page in the helpdesk app)
params.isTestBooleandisables network calls
params.cacheTimeToLiveNumberhow long to cache results for in milliseconds (default 30,000)
params.cacheIntervalRateNumberhow often to check cache expiration in milliseconds (default 2000)
params.disableCachingBooleanDisabled Caching

jitBit.ticketOrigins

Id/Value associated with Origin when creating a ticket

Kind: static property of jitBit
Date: December 09 2024 14:12 pm -0500

jitBit.ticketPriorities

Ticket Priority Levels and their ids

Kind: static property of jitBit
Date: December 09 2024 14:12 pm -0500

jitBit.ticketStatuses

jitbit built-in ticket Statuses and their ids (look at url for id of custom Status types)

Kind: static property of jitBit
Date: December 09 2024 14:12 pm -0500

0.1.0

9 months ago

0.0.10

9 months ago

0.0.9

9 months ago

0.0.8

9 months ago

0.0.7

9 months ago

0.0.6

9 months ago

0.0.5

9 months ago

0.0.4

9 months ago

0.0.3

9 months ago

0.0.2

9 months ago

0.0.1

9 months ago