{"id":24956863,"url":"https://github.com/andrewstuart/servicenow","last_synced_at":"2025-04-10T19:05:03.428Z","repository":{"id":57480234,"uuid":"105226449","full_name":"andrewstuart/servicenow","owner":"andrewstuart","description":"A golang client for ServiceNow","archived":false,"fork":false,"pushed_at":"2017-12-20T22:14:51.000Z","size":23,"stargazers_count":24,"open_issues_count":0,"forks_count":13,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-24T16:46:17.739Z","etag":null,"topics":["api-client","go","golang","json","servicenow"],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/andrewstuart.png","metadata":{"files":{"readme":"README.md","changelog":"change.go","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-09-29T03:37:19.000Z","updated_at":"2023-09-29T22:16:51.000Z","dependencies_parsed_at":"2022-09-26T17:41:38.764Z","dependency_job_id":null,"html_url":"https://github.com/andrewstuart/servicenow","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andrewstuart%2Fservicenow","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andrewstuart%2Fservicenow/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andrewstuart%2Fservicenow/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andrewstuart%2Fservicenow/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/andrewstuart","download_url":"https://codeload.github.com/andrewstuart/servicenow/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248279196,"owners_count":21077406,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api-client","go","golang","json","servicenow"],"created_at":"2025-02-03T06:41:26.823Z","updated_at":"2025-04-10T19:05:03.400Z","avatar_url":"https://github.com/andrewstuart.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# servicenow\n--\n    import \"astuart.co/servicenow\"\n\nPackage servicenow currently provides primarily low-level abstractions for\ncommunicating with the ServiceNow API, and data types useful for unmarshaling\nthe nonstandard JSON types that ServiceNow returns (e.g. non-ISO datetime\nformat). As needs arise, higher-level abstractions may be added that provide\neasy access to standard structured objects in the ServiceNow API, for example a\nmethod to easily access structs representing change requests.\n\n## Usage\n\n```go\nconst TableCMDB = \"cmdb_ci\"\n```\n\n```go\nconst TableChangeRequests = \"change_request\"\n```\n\n#### type CMDBItem\n\n```go\ntype CMDBItem struct {\n\tStatus              string `json:\"__status\"`\n\tAsset               string `json:\"asset\"`\n\tAssetTag            string `json:\"asset_tag\"`\n\tAssigned            string `json:\"assigned\"`\n\tAssignedTo          string `json:\"assigned_to\"`\n\tAssignmentGroup     string `json:\"assignment_group\"`\n\tAttributes          string `json:\"attributes\"`\n\tCanPrint            string `json:\"can_print\"`\n\tCategory            string `json:\"category\"`\n\tChangeControl       string `json:\"change_control\"`\n\tCheckedIn           string `json:\"checked_in\"`\n\tCheckedOut          string `json:\"checked_out\"`\n\tComments            string `json:\"comments\"`\n\tCompany             string `json:\"company\"`\n\tCorrelationID       string `json:\"correlation_id\"`\n\tCost                string `json:\"cost\"`\n\tCostCc              string `json:\"cost_cc\"`\n\tCostCenter          string `json:\"cost_center\"`\n\tDeliveryDate        string `json:\"delivery_date\"`\n\tDepartment          string `json:\"department\"`\n\tDiscoverySource     string `json:\"discovery_source\"`\n\tDNSDomain           string `json:\"dns_domain\"`\n\tDue                 string `json:\"due\"`\n\tDueIn               string `json:\"due_in\"`\n\tFaultCount          string `json:\"fault_count\"`\n\tFirstDiscovered     string `json:\"first_discovered\"`\n\tFqdn                string `json:\"fqdn\"`\n\tGlAccount           string `json:\"gl_account\"`\n\tInstallDate         string `json:\"install_date\"`\n\tInstallStatus       string `json:\"install_status\"`\n\tInvoiceNumber       string `json:\"invoice_number\"`\n\tIPAddress           string `json:\"ip_address\"`\n\tJustification       string `json:\"justification\"`\n\tLastDiscovered      string `json:\"last_discovered\"`\n\tLeaseID             string `json:\"lease_id\"`\n\tLocation            string `json:\"location\"`\n\tMacAddress          string `json:\"mac_address\"`\n\tMaintenanceSchedule string `json:\"maintenance_schedule\"`\n\tManagedBy           string `json:\"managed_by\"`\n\tManufacturer        string `json:\"manufacturer\"`\n\tModelID             string `json:\"model_id\"`\n\tModelNumber         string `json:\"model_number\"`\n\tMonitor             string `json:\"monitor\"`\n\tName                string `json:\"name\"`\n\tOperationalStatus   string `json:\"operational_status\"`\n\tOrderDate           string `json:\"order_date\"`\n\tOwnedBy             string `json:\"owned_by\"`\n\tPoNumber            string `json:\"po_number\"`\n\tPurchaseDate        string `json:\"purchase_date\"`\n\tSchedule            string `json:\"schedule\"`\n\tSerialNumber        string `json:\"serial_number\"`\n\tShortDescription    string `json:\"short_description\"`\n\tSkipSync            string `json:\"skip_sync\"`\n\tStartDate           string `json:\"start_date\"`\n\tSubcategory         string `json:\"subcategory\"`\n\tSupportGroup        string `json:\"support_group\"`\n\tSupportedBy         string `json:\"supported_by\"`\n\tSysClassName        string `json:\"sys_class_name\"`\n\tSysClassPath        string `json:\"sys_class_path\"`\n\tSysCreatedBy        string `json:\"sys_created_by\"`\n\tSysCreatedOn        string `json:\"sys_created_on\"`\n\tSysDomain           string `json:\"sys_domain\"`\n\tSysDomainPath       string `json:\"sys_domain_path\"`\n\tSysID               string `json:\"sys_id\"`\n\tSysModCount         string `json:\"sys_mod_count\"`\n\tSysTags             string `json:\"sys_tags\"`\n\tSysUpdatedBy        string `json:\"sys_updated_by\"`\n\tSysUpdatedOn        string `json:\"sys_updated_on\"`\n\tUnverified          string `json:\"unverified\"`\n\tVendor              string `json:\"vendor\"`\n\tWarrantyExpiration  string `json:\"warranty_expiration\"`\n}\n```\n\n\n#### type ChangeRequest\n\n```go\ntype ChangeRequest struct {\n\tStatus                   string      `json:\"__status\"`\n\tActive                   bool        `json:\"active,string\"`\n\tActivityDue              string      `json:\"activity_due\"`\n\tAdditionalAssigneeList   string      `json:\"additional_assignee_list\"`\n\tApproval                 string      `json:\"approval\"`\n\tApprovalHistory          string      `json:\"approval_history\"`\n\tApprovalSet              string      `json:\"approval_set\"`\n\tAssignedTo               string      `json:\"assigned_to\"`\n\tAssignmentGroup          string      `json:\"assignment_group\"`\n\tBackoutPlan              string      `json:\"backout_plan\"`\n\tBusinessDuration         string      `json:\"business_duration\"`\n\tBusinessService          string      `json:\"business_service\"`\n\tCabDate                  SNTime      `json:\"cab_date\"`\n\tCabDelegate              string      `json:\"cab_delegate\"`\n\tCabRecommendation        string      `json:\"cab_recommendation\"`\n\tCabRequired              bool        `json:\"cab_required,string\"`\n\tCalendarDuration         string      `json:\"calendar_duration\"`\n\tCategory                 string      `json:\"category\"`\n\tChangePlan               string      `json:\"change_plan\"`\n\tCloseCode                string      `json:\"close_code\"`\n\tCloseNotes               string      `json:\"close_notes\"`\n\tClosedAt                 SNTime      `json:\"closed_at\"`\n\tClosedBy                 string      `json:\"closed_by\"`\n\tCmdbCi                   string      `json:\"cmdb_ci\"`\n\tComments                 string      `json:\"comments\"`\n\tCommentsAndWorkNotes     string      `json:\"comments_and_work_notes\"`\n\tCompany                  string      `json:\"company\"`\n\tConflictLastRun          string      `json:\"conflict_last_run\"`\n\tConflictStatus           string      `json:\"conflict_status\"`\n\tContactType              string      `json:\"contact_type\"`\n\tCorrelationDisplay       string      `json:\"correlation_display\"`\n\tCorrelationID            string      `json:\"correlation_id\"`\n\tDeliveryPlan             string      `json:\"delivery_plan\"`\n\tDeliveryTask             string      `json:\"delivery_task\"`\n\tDescription              string      `json:\"description\"`\n\tDueDate                  SNTime      `json:\"due_date\"`\n\tEndDate                  SNTime      `json:\"end_date\"`\n\tEscalation               json.Number `json:\"escalation\"`\n\tExpectedStart            SNTime      `json:\"expected_start\"`\n\tFollowUp                 string      `json:\"follow_up\"`\n\tGroupList                string      `json:\"group_list\"`\n\tImpact                   json.Number `json:\"impact\"`\n\tImplementationPlan       string      `json:\"implementation_plan\"`\n\tJustification            string      `json:\"justification\"`\n\tKnowledge                bool        `json:\"knowledge,string\"`\n\tLocation                 string      `json:\"location\"`\n\tMadeSLA                  bool        `json:\"made_sla,string\"`\n\tNumber                   string      `json:\"number\"`\n\tOnHold                   bool        `json:\"on_hold,string\"`\n\tOnHoldReason             string      `json:\"on_hold_reason\"`\n\tOpenedAt                 SNTime      `json:\"opened_at\"`\n\tOpenedBy                 string      `json:\"opened_by\"`\n\tOrder                    string      `json:\"order\"`\n\tOutsideMaintSchedule     bool        `json:\"outside_maintenance_schedule,string\"`\n\tParent                   string      `json:\"parent\"`\n\tPhase                    string      `json:\"phase\"`\n\tPhaseState               string      `json:\"phase_state\"`\n\tPriority                 json.Number `json:\"priority\"`\n\tProductionSystem         bool        `json:\"production_system,string\"`\n\tReason                   string      `json:\"reason\"`\n\tReassignmentCount        json.Number `json:\"reassignment_count\"`\n\tRequestedBy              string      `json:\"requested_by\"`\n\tRequestedByDate          SNTime      `json:\"requested_by_date\"`\n\tReviewComments           string      `json:\"review_comments\"`\n\tReviewDate               SNTime      `json:\"review_date\"`\n\tReviewStatus             string      `json:\"review_status\"`\n\tRisk                     json.Number `json:\"risk\"`\n\tRiskImpactAnalysis       string      `json:\"risk_impact_analysis\"`\n\tScope                    json.Number `json:\"scope\"`\n\tShortDescription         string      `json:\"short_description\"`\n\tSLADue                   string      `json:\"sla_due\"`\n\tStartDate                SNTime      `json:\"start_date\"`\n\tState                    string      `json:\"state\"`\n\tStdChangeProducerVersion string      `json:\"std_change_producer_version\"`\n\tSysClassName             string      `json:\"sys_class_name\"`\n\tSysCreatedBy             string      `json:\"sys_created_by\"`\n\tSysCreatedOn             SNTime      `json:\"sys_created_on\"`\n\tSysDomain                string      `json:\"sys_domain\"`\n\tSysDomainPath            string      `json:\"sys_domain_path\"`\n\tSysID                    string      `json:\"sys_id\"`\n\tSysModCount              json.Number `json:\"sys_mod_count\"`\n\tSysTags                  string      `json:\"sys_tags\"`\n\tSysUpdatedBy             string      `json:\"sys_updated_by\"`\n\tSysUpdatedOn             SNTime      `json:\"sys_updated_on\"`\n\tTestPlan                 string      `json:\"test_plan\"`\n\tTimeWorked               string      `json:\"time_worked\"`\n\tType                     string      `json:\"type\"`\n\tUponApproval             string      `json:\"upon_approval\"`\n\tUponReject               string      `json:\"upon_reject\"`\n\tUrgency                  string      `json:\"urgency\"`\n\tUserInput                string      `json:\"user_input\"`\n\tWatchList                string      `json:\"watch_list\"`\n\tWorkEnd                  string      `json:\"work_end\"`\n\tWorkNotes                string      `json:\"work_notes\"`\n\tWorkNotesList            string      `json:\"work_notes_list\"`\n\tWorkStart                string      `json:\"work_start\"`\n}\n```\n\n\n#### type Client\n\n```go\ntype Client struct {\n\tUsername, Password, Instance string\n}\n```\n\nClient helps users interact with a ServiceNow instance.\n\n#### func (Client) GetCMDBItems\n\n```go\nfunc (c Client) GetCMDBItems(query url.Values) ([]CMDBItem, error)\n```\n\n#### func (Client) GetChangeRequests\n\n```go\nfunc (c Client) GetChangeRequests(query url.Values) ([]ChangeRequest, error)\n```\n\n#### func (Client) GetFor\n\n```go\nfunc (c Client) GetFor(table string, id string, opts url.Values, out interface{}) error\n```\nGetFor performs a servicenow get to the specified table, with options, and\nunmarhals JSON into the output parameter.\n\n#### func (Client) GetRecords\n\n```go\nfunc (c Client) GetRecords(table string, opts url.Values) ([]map[string]interface{}, error)\n```\nGetRecords performs a servicenow getRecords to the specified table, with\noptions, and returns a map for each item\n\n#### func (Client) GetRecordsFor\n\n```go\nfunc (c Client) GetRecordsFor(table string, opts url.Values, out interface{}) error\n```\nGetRecordsFor performs a servicenow getRecords to the specified table, with\noptions, and unmarhals JSON into the output parameter.\n\n#### func (Client) Insert\n\n```go\nfunc (c Client) Insert(table string, obj, out interface{}) error\n```\nInsert creates a new record for the specified table, with the specified obj\ndata, and takes a destination object out for the response data.\n\n#### func (Client) PerformFor\n\n```go\nfunc (c Client) PerformFor(table, action, id string, opts url.Values, body interface{}, out interface{}) error\n```\nPerformFor creates and executes an authenticated HTTP request to an instance,\nfor the given table, action and optional id, with the passed options, and\nunmarhals the JSON into the passed output interface pointer, returning an error.\n\n#### type Err\n\n```go\ntype Err struct {\n\tErr    string `json:\"error\"`\n\tReason string\n}\n```\n\nErr represents a possible error message that came back from the server\n\n#### func (Err) Error\n\n```go\nfunc (e Err) Error() string\n```\n\n#### type SNTime\n\n```go\ntype SNTime struct {\n\ttime.Time\n}\n```\n\n\n#### func (*SNTime) MarshalJSON\n\n```go\nfunc (s *SNTime) MarshalJSON() ([]byte, error)\n```\n\n#### func (*SNTime) UnmarshalJSON\n\n```go\nfunc (s *SNTime) UnmarshalJSON(bs []byte) error\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandrewstuart%2Fservicenow","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fandrewstuart%2Fservicenow","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandrewstuart%2Fservicenow/lists"}