add the agent ticket api
parent
a280523226
commit
0a9d085e10
|
@ -127,6 +127,17 @@ api.add_route('/ticket/list/intervention',
|
|||
# My Application: Get Ticket Status
|
||||
api.add_route('/ticket/status/{id_}',
|
||||
ticket.TicketStatusItem())
|
||||
|
||||
api.add_route('/ticket/fields/{id_}',
|
||||
ticket.TicketFieldItem())
|
||||
|
||||
api.add_route('/ticket/transition/{id_}',
|
||||
ticket.TicketTransitionItem())
|
||||
|
||||
# Patch the agent ticket
|
||||
api.add_route('/ticket/agent/{id_}',
|
||||
ticket.TicketAgentItem())
|
||||
|
||||
########################################################################################################################
|
||||
# Routes for System Core
|
||||
########################################################################################################################
|
||||
|
|
|
@ -7,8 +7,8 @@ import re
|
|||
from core.useractivity import user_logger, access_control
|
||||
import requests
|
||||
|
||||
BASE_API = 'http://172.16.203.116/'
|
||||
# BASE_API = 'http://192.168.1.4/'
|
||||
# BASE_API = 'http://172.16.203.116/'
|
||||
BASE_API = 'http://192.168.1.4/'
|
||||
|
||||
|
||||
def login():
|
||||
|
@ -745,6 +745,86 @@ class TicketStatusItem:
|
|||
resp.location = '/tickets/' + str(new_ticket_id)
|
||||
|
||||
|
||||
class TicketFieldItem:
|
||||
@staticmethod
|
||||
def __init__():
|
||||
""""Initializes ContactCollection"""
|
||||
pass
|
||||
|
||||
@staticmethod
|
||||
def on_options(req, resp, id_):
|
||||
resp.status = falcon.HTTP_200
|
||||
|
||||
@staticmethod
|
||||
def on_get(req, resp, id_):
|
||||
if not id_.isdigit() or int(id_) <= 0:
|
||||
raise falcon.HTTPError(falcon.HTTP_400, '400 Bad Request')
|
||||
|
||||
ticket_id = int(id_)
|
||||
session = login()
|
||||
url = BASE_API + "api/v1.0/tickets/" + id_
|
||||
headers = {
|
||||
'Content-Type': 'application/json',
|
||||
}
|
||||
get_resp = session.get(url, headers=headers)
|
||||
content = json.loads(get_resp.text)
|
||||
print("TicketFieldItem content", content)
|
||||
resp.text = json.dumps(content)
|
||||
|
||||
|
||||
class TicketTransitionItem:
|
||||
@staticmethod
|
||||
def __init__():
|
||||
""""Initializes ContactCollection"""
|
||||
pass
|
||||
|
||||
@staticmethod
|
||||
def on_options(req, resp, id_):
|
||||
resp.status = falcon.HTTP_200
|
||||
|
||||
@staticmethod
|
||||
def on_get(req, resp, id_):
|
||||
if not id_.isdigit() or int(id_) <= 0:
|
||||
raise falcon.HTTPError(falcon.HTTP_400, '400 Bad Request')
|
||||
|
||||
ticket_id = int(id_)
|
||||
session = login()
|
||||
url = BASE_API + "api/v1.0/tickets/" + id_ + "/transitions"
|
||||
headers = {
|
||||
'Content-Type': 'application/json',
|
||||
}
|
||||
get_resp = session.get(url, headers=headers)
|
||||
content = json.loads(get_resp.text)
|
||||
print("TicketFieldItem content", content)
|
||||
resp.text = json.dumps(content)
|
||||
|
||||
|
||||
class TicketAgentItem:
|
||||
@staticmethod
|
||||
def __init__():
|
||||
""""Initializes ContactCollection"""
|
||||
pass
|
||||
|
||||
@staticmethod
|
||||
def on_options(req, resp, id_):
|
||||
resp.status = falcon.HTTP_200
|
||||
|
||||
@staticmethod
|
||||
def on_patch(req, resp, id_):
|
||||
if not id_.isdigit() or int(id_) <= 0:
|
||||
raise falcon.HTTPError(falcon.HTTP_400, '400 Bad Request')
|
||||
|
||||
ticket_id = int(id_)
|
||||
session = login()
|
||||
url = BASE_API + "api/v1.0/tickets/" + id_
|
||||
headers = {
|
||||
'Content-Type': 'application/json',
|
||||
}
|
||||
get_resp = session.patch(url, headers=headers)
|
||||
content = json.loads(get_resp.text)
|
||||
print("TicketAgentItem content", content)
|
||||
resp.text = json.dumps(content)
|
||||
|
||||
class ContactItem:
|
||||
@staticmethod
|
||||
def __init__():
|
||||
|
|
Loading…
Reference in New Issue