API

Authentication / Tokens

Get Token

The user will need to provide their username and password to retrieve an authentication token. The authentication token is required to access all other parts of the API.

# example using httpie
http --auth <username>:<password> POST http://localhost:5000/flicket-api/tokens

Response

HTTP/1.0 200 OK
Content-Length: 50
Content-Type: application/json
Date: Sat, 29 Sep 2018 14:01:00 GMT
Server: Werkzeug/0.14.1 Python/3.6.5

{
    "token": "<token>"
}

Delete Token

# example using httpie
http DELETE http://localhost:5000/flicket-api/tokens "Authorization: Bearer <token>"

Responds

HTTP/1.0 204 NO CONTENT
Content-Length: 0
Content-Type: text/html; charset=utf-8
Date: Sat, 29 Sep 2018 14:13:19 GMT
Server: Werkzeug/0.14.1 Python/3.6.5

Users

Get User By ID

GET /flicket-api/user/(int: user_id)

Request

GET /flicket-api/user/1 HTTP/1.1
HOST: localhost:5000
Accept: application/json
Authorization: Bearer <token>

Response

HTTP/1.0 200 OK
Content-Length: 355
Content-Type: application/json
Date: Sun, 30 Jun 2019 14:15:37 GMT
Server: Werkzeug/0.14.1 Python/3.7.3

{
    "avatar": "http://127.0.0.1:5000/flicket/static/flicket_avatars/5bxk0qxt.jpg",
    "email": "evereux@gmail.com",
    "id": 1,
    "job_title": "admin",
    "links": {
        "self": "http://127.0.0.1:5000/flicket-api/user/1",
        "users": "http://127.0.0.1:5000/flicket-api/users/"
    },
    "name": "admin",
    "total_posts": 12505,
    "username": "admin"
}

Get Users

GET /flicket-api/users/

Request

GET /flicket-api/users/ HTTP/1.1
HOST: localhost:5000
Accept: application/json
Authorization: Bearer <token>

Response

HTTP/1.0 200 OK
Content-Length: 355
Content-Type: application/json
Date: Sun, 30 Jun 2019 14:15:37 GMT
Server: Werkzeug/0.14.1 Python/3.7.3

{
    "_links": {
        "next": null,
        "prev": null,
        "self": "http://localhost:5000/flicket-api/users/?page=1&per_page=50"
    },
    "_meta": {
        "page": 1,
        "per_page": 50,
        "total_items": 48,
        "total_pages": 1
    },
    "items": [
        {
            "avatar": "http://localhost:5000/flicket/static/flicket_avatars/__default_profile.png",
            "email": "evereux@gmail.com",
            "id": 1,
            "job_title": "admin",
            "links": {
                "self": "http://localhost:5000/flicket-api/user/1",
                "users": "http://localhost:5000/flicket-api/users/"
            },
            "name": "admin",
            "total_posts": 6381,
            "username": "admin"
        },
        {
            "avatar": "http://localhost:5000/flicket/static/flicket_avatars/__default_profile.png",
            "email": "admin@localhost",
            "id": 2,
            "job_title": "unknown",
            "links": {
                "self": "http://localhost:5000/flicket-api/user/2",
                "users": "http://localhost:5000/flicket-api/users/"
            },
            "name": "notification",
            "total_posts": 6445,
            "username": "notification"
        },
    ]
}

Tickets

Get Ticket By ID

GET /flicket-api/ticket/(int: ticket_id)

Request

GET /flicket-api/ticket/1 HTTP/1.1
HOST: localhost:5000
Accept: application/json
Authorization: Bearer <token>

Response

HTTP/1.0 200 OK
Content-Length: 1835
Content-Type: application/json
Date: Sun, 30 Jun 2019 14:15:37 GMT
Server: Werkzeug/0.14.1 Python/3.7.3

{
    "assigned_id": 7,
    "category_id": 1,
    "content": "She spent her earliest years reading classic literature, and writing poetry. Haskell
    features a type system with type inference and lazy evaluation. They are written as strings of
    consecutive alphanumeric characters, the first character being lowercase. Tuples are containers for
    a fixed number of Erlang data types. Erlang is a general-purpose, concurrent, functional programming
    language. Where are my pants? He looked inquisitively at his keyboard and wrote another sentence. The
    arguments can be primitive data types or compound data types. It is also a garbage-collected runtime
    system. He looked inquisitively at his keyboard and wrote another sentence. Do you come here often?
    Ports are created with the built-in function open_port. He looked inquisitively at his keyboard and
    wrote another sentence. Haskell features a type system with type inference and lazy evaluation.",
    "date_added": "Sun, 23 Jun 2019 18:25:36 GMT",
    "date_modified": null,
    "id": 1,
    "links": {
        "assigned": "http://localhost:5000/flicket-api/user/7",
        "category": "http://localhost:5000/flicket-api/category/1",
        "histories": "http://localhost:5000/flicket-api/histories/?topic_id=1",
        "modified_by": null,
        "priority": "http://localhost:5000/flicket-api/priority/3",
        "self": "http://localhost:5000/flicket-api/ticket/1",
        "started_ny": "http://localhost:5000/flicket-api/user/12",
        "status": "http://localhost:5000/flicket-api/status/2",
        "subscribers": "http://localhost:5000/flicket-api/subscriptions/1/",
        "tickets": "http://localhost:5000/flicket-api/tickets/"
    },
    "modified_id": null,
    "started_id": 12,
    "status_id": 2,
    "ticket_priority_id": 3,
    "title": "He looked inquisitively at his keyboard and wrote another sentence."
}

Get Tickets

GET /flicket-api/tickets/

Request

GET /flicket-api/tickets/ HTTP/1.1
HOST: localhost:5000
Accept: application/json
Authorization: Bearer <token>

Response

HTTP/1.0 200 OK
Content-Length: 2244
Content-Type: application/json
Date: Sun, 30 Jun 2019 14:15:37 GMT
Server: Werkzeug/0.14.1 Python/3.7.3

{
    "_links": {
        "next": "http://localhost:5000/flicket-api/tickets/2/?per_page=1",
        "prev": null,
        "self": "http://localhost:5000/flicket-api/tickets/1/?per_page=1"
    },
    "_meta": {
        "page": 1,
        "per_page": 1,
        "total_items": 10000,
        "total_pages": 10000
    },
    "items": [
        {
            "assigned_id": 7,
            "category_id": 1,
            "content": "She spent her earliest years reading classic literature, and writing poetry. Haskell
            features a type system with type inference and lazy evaluation. They are written as strings of
            consecutive alphanumeric characters, the first character being lowercase. Tuples are containers
            for a fixed number of Erlang data types. Erlang is a general-purpose, concurrent, functional
            programming language. Where are my pants? He looked inquisitively at his keyboard and wrote
            another sentence. The arguments can be primitive data types or compound data types. It is also a
            garbage-collected runtime system. He looked inquisitively at his keyboard and wrote another
            sentence. Do you come here often? Ports are created with the built-in function open_port. He
            looked inquisitively at his keyboard and wrote another sentence. Haskell features a type system
            with type inference and lazy evaluation.",
            "date_added": "Sun, 23 Jun 2019 18:25:36 GMT",
            "date_modified": null,
            "id": 1,
            "links": {
                "assigned": "http://localhost:5000/flicket-api/user/7",
                "category": "http://localhost:5000/flicket-api/category/1",
                "histories": "http://localhost:5000/flicket-api/histories/?topic_id=1",
                "modified_by": null,
                "priority": "http://localhost:5000/flicket-api/priority/3",
                "self": "http://localhost:5000/flicket-api/ticket/1",
                "started_ny": "http://localhost:5000/flicket-api/user/12",
                "status": "http://localhost:5000/flicket-api/status/2",
                "subscribers": "http://localhost:5000/flicket-api/subscriptions/1/",
                "tickets": "http://localhost:5000/flicket-api/tickets/"
            },
            "modified_id": null,
            "started_id": 12,
            "status_id": 2,
            "ticket_priority_id": 3,
            "title": "He looked inquisitively at his keyboard and wrote another sentence."
        }
    ]
}

Create Ticket

POST /flicket-api/tickets(str:title,str:content,int:category_id,int:ticket_priority_id)

Request

POST /flicket-api/tickets HTTP/1.1
HOST: localhost:5000
Accept: application/json
Authorization: Bearer <token>

{
    "title": "this is my ticket",
    "content": "this is my content",
    "category_id": 1,
    "ticket_priority_id": 1
}

Response

HTTP/1.0 201 CREATED
Content-Length: 903
Content-Type: application/json
Date: Fri, 28 Jun 2019 12:04:59 GMT
Location: http://localhost:5000/flicket-api/ticket/10001
Server: Werkzeug/0.14.1 Python/3.7.3

{
    "assigned_id": null,
    "category_id": 1,
    "content": "this is my content",
    "date_added": "Fri, 28 Jun 2019 13:04:59 GMT",
    "date_modified": null,
    "id": 10001,
    "links": {
        "assigned": null,
        "category": "http://localhost:5000/flicket-api/category/1",
        "histories": "http://localhost:5000/flicket-api/histories/?topic_id=10001",
        "modified_by": null,
        "priority": "http://localhost:5000/flicket-api/priority/1",
        "self": "http://localhost:5000/flicket-api/ticket/10001",
        "started_ny": "http://localhost:5000/flicket-api/user/1",
        "status": "http://localhost:5000/flicket-api/status/1",
        "subscribers": "http://localhost:5000/flicket-api/subscriptions/10001/",
        "tickets": "http://localhost:5000/flicket-api/tickets/"
    },
    "modified_id": null,
    "started_id": 1,
    "status_id": 1,
    "ticket_priority_id": 1,
    "title": "this is my ticket"
}

Posts

Get Post By ID

GET /flicket-api/post/(int: post_id)

Request

GET /flicket-api/priority/1 HTTP/1.1
HOST: localhost:5000
Accept: application/json
Authorization: Bearer <token>

Response

HTTP/1.0 200 OK
Content-Length: 1231
Content-Type: application/json
Date: Sun, 30 Jun 2019 13:00:13 GMT
Server: Werkzeug/0.14.1 Python/3.7.3

{
    "content": "The Galactic Empire is nearing completion of the Death Star, a space station with the power
     to destroy entire planets. Initially ...",
    "data_added": "Sun, 05 May 2019 14:19:42 GMT",
    "date_modified": null,
    "id": 1,
    "links": {
        "created_by": "http://127.0.0.1:5000/flicket-api/user/15",
        "posts": "http://127.0.0.1:5000/flicket-api/posts/1/",
        "self": "http://127.0.0.1:5000/flicket-api/post/1"
    },
    "ticket_id": 1,
    "user_id": 15
}

Get Posts

Retrieve all posts associated to a ticket by ticket_id.

GET /flicket-api/posts/(int: ticket_id)/(int: page)/

Request

GET /flicket-api/posts/1/ HTTP/1.1
HOST: localhost:5000
Accept: application/json
Authorization: Bearer <token>

Response

HTTP/1.0 200 OK
Content-Length: 27640
Content-Type: application/json
Date: Sun, 30 Jun 2019 15:41:09 GMT
Server: Werkzeug/0.14.1 Python/3.7.3

{
    "_links": {
        "next": null,
        "prev": null,
        "self": "http://127.0.0.1:5000/flicket-api/posts/1/1/?per_page=50"
    },
    "_meta": {
        "page": 1,
        "per_page": 50,
        "total_items": 25,
        "total_pages": 1
    },
    "items": [
        {
            "content": "The Galactic Empire is nearing completion of the Death Star, a space station with
            the power to destroy entire planets. Initially composing light-hearted and irreverent works,
            he also wrote serious, sombre and religious pieces beginning in the 1930s. Erlang is known for
            its designs that are well suited for systems. It is also a garbage-collected runtime system.
            They are written as strings of consecutive alphanumeric characters, the first character being
            lowercase. The sequential subset of Erlang supports eager evaluation, single assignment, and
            dynamic typing. Tuples are containers for a fixed number of Erlang data types. Tuples are
            containers for a fixed number of Erlang data types. The arguments can be primitive data types
            or compound data types. Type classes first appeared in the Haskell programming language. The
            arguments can be primitive data types or compound data types.",
            "data_added": "Sun, 05 May 2019 14:19:42 GMT",
            "date_modified": null,
            "id": 1,
            "links": {
                "created_by": "http://127.0.0.1:5000/flicket-api/user/15",
                "posts": "http://127.0.0.1:5000/flicket-api/posts/1/",
                "self": "http://127.0.0.1:5000/flicket-api/post/1"
            },
            "ticket_id": 1,
            "user_id": 15
        }
    ]
}

Departments

Get Department by ID

GET /flicket-api/department/(int: department_id)

Request

GET /flicket-api/department/1 HTTP/1.1
HOST: localhost:5000
Accept: application/json
Authorization: Bearer <token>

Response

HTTP/1.0 200 OK
Content-Length: 191
Content-Type: application/json
Date: Sun, 30 Jun 2019 12:37:21 GMT
Server: Werkzeug/0.14.1 Python/3.7.3

{
    "department": "Design",
    "id": 1,
    "links": {
        "departments": "http://127.0.0.1:5000/flicket-api/departments/",
        "self": "http://127.0.0.1:5000/flicket-api/department/1"
    }
}

Get Departments

GET /flicket-api/departments/

Request

GET /flicket-api/departments/ HTTP/1.1
HOST: localhost:5000
Accept: application/json
Authorization: Bearer <token>

Response

HTTP/1.0 200 OK
Content-Length: 2307
Content-Type: application/json
Date: Sun, 30 Jun 2019 12:40:21 GMT
Server: Werkzeug/0.14.1 Python/3.7.3

{
    "_links": {
        "next": null,
        "prev": null,
        "self": "http://127.0.0.1:5000/flicket-api/departments/?page=1&per_page=50"
    },
    "_meta": {
        "page": 1,
        "per_page": 50,
        "total_items": 9,
        "total_pages": 1
    },
    "items": [
        {
            "department": "Commercial",
            "id": 6,
            "links": {
                "departments": "http://127.0.0.1:5000/flicket-api/departments/",
                "self": "http://127.0.0.1:5000/flicket-api/department/6"
            }
        },
        {
            "department": "Design",
            "id": 1,
            "links": {
                "departments": "http://127.0.0.1:5000/flicket-api/departments/",
                "self": "http://127.0.0.1:5000/flicket-api/department/1"
            }
        },
        {
            "department": "Human Resources",
            "id": 5,
            "links": {
                "departments": "http://127.0.0.1:5000/flicket-api/departments/",
                "self": "http://127.0.0.1:5000/flicket-api/department/5"
            }
        },
        {
            "department": "IT",
            "id": 3,
            "links": {
                "departments": "http://127.0.0.1:5000/flicket-api/departments/",
                "self": "http://127.0.0.1:5000/flicket-api/department/3"
            }
        }
    ]
}

Create Department

POST http://localhost:5000/flicket-api/departments(str: department)

Request

POST /flicket-api/departments HTTP/1.1
HOST: localhost:5000
Accept: application/json
Authorization: Bearer <token>

{
    "department": "new department"
}

Response

Priorities

Get Priority By ID

GET /flicket-api/priority/(int: priority_id)

Request

GET /flicket-api/priority/1 HTTP/1.1
HOST: localhost:5000
Accept: application/json
Authorization: Bearer <token>

Response

HTTP/1.0 200 OK
Content-Length: 182
Content-Type: application/json
Date: Sun, 30 Jun 2019 14:15:37 GMT
Server: Werkzeug/0.14.1 Python/3.7.3

{
    "id": 1,
    "links": {
        "priorities": "http://127.0.0.1:5000/flicket-api/priorities/",
        "self": "http://127.0.0.1:5000/flicket-api/priority/1"
    },
    "priority": "low"
}

Get Priorities

GET /flicket-api/priorities/

Request

GET /flicket-api/priorities/ HTTP/1.1
HOST: localhost:5000
Accept: application/json
Authorization: Bearer <token>

Response

HTTP/1.0 200 OK
Content-Length: 903
Content-Type: application/json
Date: Sun, 30 Jun 2019 12:34:06 GMT
Server: Werkzeug/0.14.1 Python/3.7.3

{
    "_links": {
        "next": null,
        "prev": null,
        "self": "http://127.0.0.1:5000/flicket-api/priorities/1/?per_page=50"
    },
    "_meta": {
        "page": 1,
        "per_page": 50,
        "total_items": 3,
        "total_pages": 1
    },
    "items": [
        {
            "id": 1,
            "links": {
                "priorities": "http://127.0.0.1:5000/flicket-api/priorities/",
                "self": "http://127.0.0.1:5000/flicket-api/priority/1"
            },
            "priority": "low"
        },
        {
            "id": 2,
            "links": {
                "priorities": "http://127.0.0.1:5000/flicket-api/priorities/",
                "self": "http://127.0.0.1:5000/flicket-api/priority/2"
            },
            "priority": "medium"
        },
        {
            "id": 3,
            "links": {
                "priorities": "http://127.0.0.1:5000/flicket-api/priorities/",
                "self": "http://127.0.0.1:5000/flicket-api/priority/3"
            },
            "priority": "high"
        }
    ]
}

Status

Get Status By ID

GET /flicket-api/status/(int: status_id)

Request

GET /flicket-api/status/1 HTTP/1.1
HOST: localhost:5000
Accept: application/json
Authorization: Bearer <token>

Response

HTTP/1.0 200 OK
Content-Length: 175
Content-Type: application/json
Date: Mon, 01 Jul 2019 11:17:00 GMT
Server: Werkzeug/0.14.1 Python/3.7.3

{
    "id": 1,
    "links": {
        "self": "http://127.0.0.1:5000/flicket-api/status/1",
        "statuses": "http://127.0.0.1:5000/flicket-api/statuses/"
    },
    "status": "Open"
}

Get Statuses

GET /flicket-api/statuses/

Request

GET /flicket-api/statuses/ HTTP/1.1
HOST: localhost:5000
Accept: application/json
Authorization: Bearer <token>

Response

HTTP/1.0 200 OK
Content-Length: 1114
Content-Type: application/json
Date: Mon, 01 Jul 2019 11:18:23 GMT
Server: Werkzeug/0.14.1 Python/3.7.3

{
    "_links": {
        "next": null,
        "prev": null,
        "self": "http://127.0.0.1:5000/flicket-api/departments/?page=1&per_page=50"
    },
    "_meta": {
        "page": 1,
        "per_page": 50,
        "total_items": 4,
        "total_pages": 1
    },
    "items": [
        {
            "id": 1,
            "links": {
                "self": "http://127.0.0.1:5000/flicket-api/status/1",
                "statuses": "http://127.0.0.1:5000/flicket-api/statuses/"
            },
            "status": "Open"
        },
        {
            "id": 2,
            "links": {
                "self": "http://127.0.0.1:5000/flicket-api/status/2",
                "statuses": "http://127.0.0.1:5000/flicket-api/statuses/"
            },
            "status": "Closed"
        },
        {
            "id": 3,
            "links": {
                "self": "http://127.0.0.1:5000/flicket-api/status/3",
                "statuses": "http://127.0.0.1:5000/flicket-api/statuses/"
            },
            "status": "In Work"
        },
        {
            "id": 4,
            "links": {
                "self": "http://127.0.0.1:5000/flicket-api/status/4",
                "statuses": "http://127.0.0.1:5000/flicket-api/statuses/"
            },
            "status": "Awaiting Information"
        }
    ]
}

Subscriptions

Get Subscription By ID

GET /flicket-api/subscription/(int: subscription_id)

Request

GET /flicket-api/subscription/1 HTTP/1.1
HOST: localhost:5000
Accept: application/json
Authorization: Bearer <token>

Response

HTTP/1.0 200 OK
Content-Length: 356
Content-Type: application/json
Date: Mon, 01 Jul 2019 11:21:57 GMT
Server: Werkzeug/0.14.1 Python/3.7.3

{
    "id": 1,
    "links": {
        "self": "http://127.0.0.1:5000/flicket-api/subscription/1",
        "subscriptions": "http://127.0.0.1:5000/flicket-api/subscriptions/",
        "ticket": "http://127.0.0.1:5000/flicket-api/ticket/10001",
        "user": "http://127.0.0.1:5000/flicket-api/user/1"
    },
    "ticket_id": 10001,
    "user_def": "admin",
    "user_id": 1
}

Get Subscriptions

Get all subscribers to ticket.

GET /flicket-api/subscriptions/(int: ticket_id)/

Request

GET /flicket-api/users/ HTTP/1.1
HOST: localhost:5000
Accept: application/json
Authorization: Bearer <token>

Response

HTTP/1.0 200 OK
Content-Length: 666
Content-Type: application/json
Date: Mon, 01 Jul 2019 11:27:12 GMT
Server: Werkzeug/0.14.1 Python/3.7.3

{
    "_links": {
        "next": null,
        "prev": null,
        "self": "http://127.0.0.1:5000/flicket-api/subscriptions/10001/1/?per_page=50"
    },
    "_meta": {
        "page": 1,
        "per_page": 50,
        "total_items": 1,
        "total_pages": 1
    },
    "items": [
        {
            "id": 1,
            "links": {
                "self": "http://127.0.0.1:5000/flicket-api/subscription/1",
                "subscriptions": "http://127.0.0.1:5000/flicket-api/subscriptions/",
                "ticket": "http://127.0.0.1:5000/flicket-api/ticket/10001",
                "user": "http://127.0.0.1:5000/flicket-api/user/1"
            },
            "ticket_id": 10001,
            "user_def": "admin",
            "user_id": 1
        }
    ]
}

Uploads

Get Upload By ID

GET /flicket-api/upload/(int: upload_id)

Request

GET /flicket-api/upload/1 HTTP/1.1
HOST: localhost:5000
Accept: application/json
Authorization: Bearer <token>

Response

HTTP/1.0 200 OK
Content-Length: 415
Content-Type: application/json
Date: Mon, 01 Jul 2019 11:46:54 GMT
Server: Werkzeug/0.14.1 Python/3.7.3

{
    "filename": "ccv4ufb6.jpg",
    "id": 1,
    "image": "http://127.0.0.1:5000/flicket_uploads/ccv4ufb6.jpg",
    "links": {
        "post": "http://127.0.0.1:5000/flicket-api/post/276646",
        "self": "http://127.0.0.1:5000/flicket-api/upload/1",
        "ticket": null,
        "uploads": "http://127.0.0.1:5000/flicket-api/uploads/"
    },
    "original_filename": "photos-1.jpg",
    "post_id": 276646,
    "topic_id": null
}

Get Uploads

GET /flicket-api/uploads/

Request

GET /flicket-api/uploads/ HTTP/1.1
HOST: localhost:5000
Accept: application/json
Authorization: Bearer <token>

Response

HTTP/1.0 200 OK
Content-Length: 1231
Content-Type: application/json
Date: Mon, 01 Jul 2019 11:49:33 GMT
Server: Werkzeug/0.14.1 Python/3.7.3

{
    "_links": {
        "next": null,
        "prev": null,
        "self": "http://127.0.0.1:5000/flicket-api/uploads/1/?per_page=50"
    },
    "_meta": {
        "page": 1,
        "per_page": 50,
        "total_items": 2,
        "total_pages": 1
    },
    "items": [
        {
            "filename": "ccv4ufb6.jpg",
            "id": 1,
            "image": "http://127.0.0.1:5000/flicket_uploads/ccv4ufb6.jpg",
            "links": {
                "post": "http://127.0.0.1:5000/flicket-api/post/276646",
                "self": "http://127.0.0.1:5000/flicket-api/upload/1",
                "ticket": null,
                "uploads": "http://127.0.0.1:5000/flicket-api/uploads/"
            },
            "original_filename": "photos-1.jpg",
            "post_id": 276646,
            "topic_id": null
        },
        {
            "filename": "5w0hdo10.jpg",
            "id": 2,
            "image": "http://127.0.0.1:5000/flicket_uploads/5w0hdo10.jpg",
            "links": {
                "post": "http://127.0.0.1:5000/flicket-api/post/276677",
                "self": "http://127.0.0.1:5000/flicket-api/upload/2",
                "ticket": null,
                "uploads": "http://127.0.0.1:5000/flicket-api/uploads/"
            },
            "original_filename": "the_basta_rock_sunrise_4k-wallpaper-3554x1999.jpg",
            "post_id": 276677,
            "topic_id": null
        }
    ]
}