Overview

This service allows customers to create service tickets to report issues to a customer service agent for resolution. You can configure service ticket types for the different services you provide, such as requests for repairs, requests for servicing, and general inquiries.

When you create a service ticket, you can specify the information to collect in the tickets you customers submit. For example:

  • A short description of the customer's issue or request
  • The customer for whom the service ticket was opened
  • The product that the request or issue relates to

Manage the service ticket resolution process with features such as:

  • Built-in status management
  • A transcript concept that allows customer service agents to enter additional information about the processing status
  • Automatic calculation of processing times
Only a registered customer can consume this service. The customer ID is equivalent to the hybris-user passed in the token. The service also restricts the customer from viewing or creating tickets on another customer's behalf.

For agent access, see the API documentation for the Service Tickets service.


API Reference

/{tenant}/serviceTickets

Service tickets

/{tenant}/serviceTickets

get

Retrieve a collection of service tickets for a customer.

If no query is specified, all service tickets for the customer are returned in the result collection. To filter the result collection, use the query parameter q. To filter the result collection, use the query parameter q. The service ticket service uses the same query syntax as the Document service. For more information on Service Tickets, see the Service Ticket documentation.

You can sort the result collection using the query parameter sort.

Only persisted fields can be used for querying and sorting. The following fields are transient and cannot be used for formulating queries or sorting the result collection:

  1. Type description (typeDescription)
  2. Classification description (classification.description)
  3. Priority description (priorityDescription)
  4. Status description (statusDescription)
  5. Customer attributes: 5.1. Customer e-mail address (customerEmail) 5.2. Customer title (customerTitle) 5.3. Customer first name (customerFirstName) 5.4. Customer last name (customerLastName)
  6. Product attributes: 6.1. Product name (productName)

If you would like to query or sort by those attributes, use the following persisted attributes instead:

  1. Type (type)
  2. Classification (classification)
  3. Priority (priority)
  4. Status (status)
  5. Product id (productId)

The GET method is paged. Use the query parameters pageNumber to control which page is retrieved. Use the query parameter pageSize to control the number of service tickets per page. The maximum pageSize supported is 64.

post

Create a new service ticket for the customer.

The id of the service ticket is automatically generated by the system. It is returned in the field id in the response body. It is also part of the response header Location.

Upon successful creation of the service ticket, the PubSub event serviceticket-created is raised.

/{tenant}/serviceTickets/{serviceTicketId}

Service ticket

get

Retrieves a single service ticket. The service ticket to be retrieved is identified by its id.

put

Updates a single service ticket either to OPEN or CONFIRMED

The service ticket to be updated is identified by its id.

Note that creating a service ticket with a caller-specified id is not allowed. Use the POST method at the endpoint /{tenant}/serviceTickets to create service tickets and have their ids generated by the system.

Upon successful update of the service ticket, the PubSub event serviceticket-updated is raised.

delete

Deletes a single serviceTicket entity.

/{tenant}/serviceTicketTypes

Service ticket type configuration

/{tenant}/serviceTicketTypes

get

Retrieves a list of configured service ticket types. For more information, see the Service Ticket Types service documentation.

/{tenant}/serviceTicketStatus

Service ticket statuses

/{tenant}/serviceTicketStatus

get

Retrieves allowed list of service ticket status. For more information, see the Service ticket statuses service documentation.

/{tenant}/interactionLogs

Interaction Logs

/{tenant}/interactionLogs

get
post

Create a new interaction log item for the customer action such as a new product registration or creation of a new service ticket.

The customerId of the interaction log is required in order to link the interaction to the specific customer.

The id of the service ticket is automatically generated by the system. It is returned in the field id in the response body. It is also part of the response header Location.

/{tenant}/chatTranscripts

Chat Transcripts

/{tenant}/chatTranscripts/{id}

get


CECenter Mashup

Introduction

This service allows customers to create service tickets to report issues to a customer service agent for resolution.

The tutorials uses these endpoints to manage service tickets for customers in the service:

  • Use /{tenant}/serviceTicketTypes to retrieve Service tickets types.
  • Use /{tenant}/serviceTicketStatus to retrieve Service ticket statuses.
  • Call /{tenant}/serviceTickets to get a list of service tickets and creates service ticket. An end application, such as a storefront, can use this endpoint to show service tickets for a logged in customer.
  • Use /{tenant}/serviceTickets/{serviceTicketId} to retrieve and update a specified service ticket.
  • Call /{tenant}/interactionLogs to create interaction log for actions such as product registration or a new service ticket created by the customer.

Set up the project

Follow the examples to set up and run the tutorial project.

Define variable assertion

clientId = clientIdPlaceholder;
clientSecret = clientSecretPlaceholder;
tenant = projectIdPlaceholder;
client = appIdPlaceholder;
scopesRequired = 'hybris.tenant='+tenant+' hybris.customer_read hybris.customer_create hybris.product_read_unpublished hybris.product_create hybris.product_publish hybris.serviceticket_view hybris.serviceticket_manage hybris.serviceticket_configuration_view hybris.interactionlog_manage';
token = tokenPlaceholder;
assert = chai.assert;

Get an access token

For proper authorization to perform these operations, you must provide a valid Bearer access token in your request header. To do so, create an API Client for the OAuth2 service:

API.createClient('oAuth2Service',
'/services/oauth2/v1/api.raml');

Now, get the token:

AccessToken = oAuth2Service.token.post({
  'client_id' : clientId,
  'client_secret': clientSecret,
  'grant_type' : 'client_credentials',
  'token_type': 'Bearer',
  'scope': scopesRequired
});
access_token = AccessToken.body.access_token;

Create a product

API.createClient('productService',
'/services/product/v2/api.raml');

Please note that the product code is unique. If this code is executed more than once, ensure to edit the product code.

productResponse = productService.tenant(tenant).products.post({
    "name": "Smartphone Zony Yperia X2",
    "code": "SZYX",
    "description": "The world's best camera and camcorder in a waterproof smartphone."    ,
    "published":true  
    }, {
      headers: {
        'Authorization': 'Bearer ' + access_token,
        'Content-Type' : 'application/json',
        'Content-Language' : 'en'
      }
    }
)

assert.equal(productResponse.status, 201);
productResponse;
productId = productResponse.body.id;

Signup a customer

API.createClient('customerService',
'/services/customer/v1/api.raml');

Please note that the email is unique. If this code is executed more than once, ensure to edit the email and retain the domain as it is.

customerResponse = customerService.tenant(tenant).signup.post({
    "email": "testme@yaastest.com",
    "password": "secret"      
    }, {
      headers: {
        'Authorization': 'Bearer ' + access_token,
        'Content-Type' : 'application/json'
      }
    }
)

assert.equal(customerResponse.status, 201);
customerResponse;
customerId = customerResponse.body.id;

Now, get the logged in customer's access token

customerResponse = customerService.tenant(tenant).login.post({
    "email": "testme@yaastest.com",
    "password": "secret"      
    }, {
      headers: {
        'Authorization': 'Bearer ' + access_token,
        'Content-Type' : 'application/json'
      }
    }
)

assert.equal(customerResponse.status, 200);
customerResponse;
customer_access_token = customerResponse.body.accessToken;

Create an API client for the CECenter Mashup service

API.createClient('cecenterMashup',
'/services/cecentermashup/v1/api.raml');

Get service ticket types

Send a GET request to the /{tenant}/serviceTicketTypes endpoint to retrieve a list of pre-configured service ticket types. The service ticket types can be configured in Service ticket settings from the Builder UI.

response = cecenterMashup.tenant(tenant).serviceTicketTypes.get({}, {
      headers: {
        'Authorization': 'Bearer ' + access_token,
        'Content-Type' : 'application/json'
      }
    }
)
assert.equal(response.status, 200);
response;

For more information, see the Service Ticket Types service documentation.

Get service ticket statuses

Send a GET request to the /{tenant}/serviceTicketStatus endpoint to retrieve a list of pre-configured service ticket statuses. The service ticket statuses can be configured in Service ticket settings from the Builder UI.

response = cecenterMashup.tenant(tenant).serviceTicketStatus.get({}, {
      headers: {
        'Authorization': 'Bearer ' + access_token,
        'Content-Type' : 'application/json'
      }
    }
)
assert.equal(response.status, 200);
response;

For more information, see the Service Ticket Statuses service documentation.

Create a service ticket

Send a POST request to the /{tenant}/serviceTickets endpoint to create a new service ticket. Creating a service ticket requires JSON input. Only the authenticated customer specified upon ticket creation can manage the ticket. For agent access, see the Service Ticket service documentation.

response = cecenterMashup.tenant(tenant).serviceTickets.post({
    "type":"SERVICE_REQUEST",
    "status":"OPEN",
    "customerId":customerId,
    "productId":productId,
    "shortDescription":"My tv does not work",
    "createdBy":"SYSTEM"      
    }, {
      headers: {
        'Authorization': 'Bearer ' + customer_access_token,
        'Content-Type' : 'application/json'
      }
    }
)

assert.equal(response.status, 201);
response;

Get a list of service tickets

Send a GET request to the /{tenant}/serviceTickets/ endpoint to retrieve a list of service tickets. Only the authenticated customer specified in the request can view the list of service tickets. For agent access, see the Service Ticket service documentation.

To make the calls simple and the code examples clean, this example assigns the returned object to the existingServiceTicket variable.

response = cecenterMashup.tenant(tenant).serviceTickets.get({}, {
      headers: {
        'Authorization': 'Bearer ' + customer_access_token,
        'Content-Type' : 'application/json'
      }
    }
)

assert.equal(response.status, 200);
existingServiceTicket = response.body[0];
existingServiceTicketId = existingServiceTicket.id;
response;

Get a service ticket by ID

Send a GET request to the /{tenant}/serviceTickets/{serviceTicketId} endpoint to retrieve a service ticket by ID. Only the authenticated customer specified in the request can view the retrieved service ticket. For agent access, see the Service Ticket service documentation.

response = cecenterMashup.tenant(tenant).serviceTickets.serviceTicketId(existingServiceTicketId).get({}, {
      headers: {
        'Authorization': 'Bearer ' + customer_access_token,
        'Content-Type' : 'application/json'
      }
    }
)
assert.equal(response.status, 200);
existingServiceTicket = response.body;
response;

Update a service ticket by ID

Send a PUT request to the /{tenant}/serviceTickets/{serviceTicketId} to update an existing service ticket by ID. Updating a service ticket requires JSON input. Only the authenticated customer specified in the request can update the retrieved service ticket. For agent access, see the Service Ticket service documentation.


existingServiceTicket.shortDescription = "My tv remote does not work"
response = cecenterMashup.tenant(tenant).serviceTickets.serviceTicketId(existingServiceTicketId).put(existingServiceTicket, {
      headers: {
        'Authorization': 'Bearer ' + customer_access_token,
        'Content-Type' : 'application/json'
      }
    }
)
assert.equal(response.status, 204);
response;


  • Send feedback

    If you find any information that is unclear or incorrect, please let us know so that we can improve the Dev Portal content.

  • Get Help

    Use our private help channel. Receive updates over email and contact our specialists directly.

  • hybris Experts

    If you need more information about this topic, visit hybris Experts to post your own question and interact with our community and experts.