service_categories

GET

Get all requested Service Categories.

Auth. Required

Yes

Roles Required

None

Response Type

Array

Request Structure

Table 235 Request Query Parameters

Name

Description

name

Filter for Service Categories with this name

orderby

Choose the ordering of the results - must be the name of one of the fields of the objects in the response array

sortOrder

Changes the order of sorting. Either ascending (default or “asc”) or descending (“desc”)

limit

Choose the maximum number of results to return

offset

The number of results to skip before beginning to return results. Must use in conjunction with limit

page

Return the nth page of results, where “n” is the value of this parameter, pages are limit long and the first page is 1. If offset was defined, this query parameter has no effect. limit must be defined to make use of page.

#533 Request Example
GET /api/3.0/service_categories?name=SERVICE_CATEGORY_NAME HTTP/1.1
Host: trafficops.infra.ciab.test
User-Agent: curl/7.47.0
Accept: */*
Cookie: mojolicious=...

Response Structure

name

This Service Category’s name

lastUpdated

The date and time at which this Service Category was last modified, in Traffic Ops’s Custom Date/Time Format

#534 Response Example
HTTP/1.1 200 OK
Access-Control-Allow-Credentials: true
Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept, Set-Cookie, Cookie
Access-Control-Allow-Methods: POST,GET,OPTIONS,PUT,DELETE
Access-Control-Allow-Origin: *
Content-Type: application/json
Set-Cookie: mojolicious=...; Path=/; Expires=Mon, 18 Nov 2019 17:40:54 GMT; Max-Age=3600; HttpOnly
Whole-Content-Sha512: Yzr6TfhxgpZ3pbbrr4TRG4wC3PlnHDDzgs2igtz/1ppLSy2MzugqaGW4y5yzwzl5T3+7q6HWej7GQZt1XIVeZQ==
X-Server-Name: traffic_ops_golang/
Date: Wed, 11 Mar 2020 20:02:47 GMT
Content-Length: 102

{
    "response": [
        {
            "lastUpdated": "2020-03-04 15:46:20-07",
            "name": "SERVICE_CATEGORY_NAME"
        }
    ]
}

POST

Create a new service category.

Auth. Required

Yes

Roles Required

“admin” or “operations”

Response Type

Object

Request Structure

name

This Service Category’s name

#535 Request Example
POST /api/3.0/service_categories HTTP/1.1
Host: trafficops.infra.ciab.test
User-Agent: curl/7.47.0
Accept: */*
Cookie: mojolicious=...
Content-Length: 48
Content-Type: application/json

{
    "name": "SERVICE_CATEGORY_NAME",
}

Response Structure

name

This Service Category’s name

lastUpdated

The date and time at which this Service Category was last modified, in Traffic Ops’s Custom Date/Time Format

#536 Response Example
HTTP/1.1 200 OK
Access-Control-Allow-Credentials: true
Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept, Set-Cookie, Cookie
Access-Control-Allow-Methods: POST,GET,OPTIONS,PUT,DELETE
Access-Control-Allow-Origin: *
Content-Type: application/json
Set-Cookie: mojolicious=...; Path=/; Expires=Mon, 18 Nov 2019 17:40:54 GMT; Max-Age=3600; HttpOnly
Whole-Content-Sha512: +pJm4c3O+JTaSXNt+LP+u240Ba/SsvSSDOQ4rDc6hcyZ0FIL+iY/WWrMHhpLulRGKGY88bM4YPCMaxGn3FZ9yQ==
X-Server-Name: traffic_ops_golang/
Date: Wed, 11 Mar 2020 20:12:20 GMT
Content-Length: 154

{
    "alerts": [
        {
            "text": "serviceCategory was created.",
            "level": "success"
        }
    ],
    "response": {
        "lastUpdated": "2020-03-11 14:12:20-06",
        "name": "SERVICE_CATEGORY_NAME"
    }
}

DELETE

Deletes a specific Service Category.

Auth. Required

Yes

Roles Required

“admin” or “operations”

Response Type

undefined

Request Structure

#537 Request Example
DELETE /api/3.0/service_categories/my-service-category HTTP/1.1
User-Agent: python-requests/2.23.0
Accept-Encoding: gzip, deflate
Accept: */*
Connection: keep-alive
Cookie: mojolicious=...
Content-Length: 0

Response Structure

#538 Response Example
HTTP/1.1 200 OK
Access-Control-Allow-Credentials: true
Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept, Set-Cookie, Cookie
Access-Control-Allow-Methods: POST,GET,OPTIONS,PUT,DELETE
Access-Control-Allow-Origin: *
Content-Encoding: gzip
Content-Type: application/json
Set-Cookie: mojolicious=...; Path=/; Expires=Mon, 17 Aug 2020 16:13:31 GMT; Max-Age=3600; HttpOnly
Whole-Content-Sha512: yErJobzG9IA0khvqZQK+Yi7X4pFVvOqxn6PjrdzN5DnKVm/K8Kka3REul1XmKJnMXVRY8RayoEVGDm16mBFe4Q==
X-Server-Name: traffic_ops_golang/
Date: Mon, 17 Aug 2020 15:13:31 GMT
Content-Length: 93

{
    "alerts": [
        {
            "text": "serviceCategory was deleted.",
            "level": "success"
        }
    ]
}