Freshdesk supports as a complete ticketing platform
Posted By : Rupesh Sharma | 14-Jul-2018
- DASHBOARD - Types of the tickets and other basic information of your account.
- TICKETS- Check all of your tickets and details related to that.
- CONTACTS-The customer information and their contact details.
- SOLUTIONS-General issue and their solutions related to the services are available.
- FORUM-The common issues are raised here.
- REPORTS-Freshdesk analysis and the productivity and performance of the account yet so far are available.
- SETTINGS-Admin settings in order to provide customization in the services provided to the user organization.
Here we can look at some basic steps to use APIs provided by Freshdesk using their API documentation:
Lets take an example where we are sending the user queries in the form of json object so for that first we need to convert user information object into json string in order to send it to Freshdesk server using rest template.
package com.bookmygain.service;
import java.io.IOException;
import org.apache.tomcat.util.codec.binary.Base64;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;
import com.bookmygain.conf.EnvConfiguration;
import com.bookmygain.dto.ContactUsDto;
import com.bookmygain.forms.ContactUsForm;
import com.fasterxml.jackson.databind.ObjectMapper;
@Service
public class CreateTicketService {
@Autowired
private EnvConfiguration envConfiguration;
public String createTicket(ContactUsForm contactUsForm)
{
String jsonStr = null;
ObjectMapper mapperObj = new ObjectMapper();
try {
jsonStr = mapperObj.writeValueAsString(contactUsDto);
} catch (IOException e) {
e.printStackTrace();
}
final String uri =envConfiguration.getFreshdeskuri();
String plainCreds =envConfiguration.getFreshdeskuname()+":"+envConfiguration.getFreshdeskpass();
byte[] plainCredsBytes = plainCreds.getBytes();
byte[] base64CredsBytes = Base64.encodeBase64(plainCredsBytes);
String base64Creds = new String(base64CredsBytes);
HttpHeaders headers = new HttpHeaders();
headers.add("Authorization", "Basic " + base64Creds);
headers.setContentType(MediaType.APPLICATION_JSON);
HttpEntity httpEntity = new HttpEntity(jsonStr.toString().trim(), headers);
RestTemplate rst = new RestTemplate();
ResponseEntity response = rst.postForEntity(uri, httpEntity, String.class);
HttpStatus statusCode = response.getStatusCode();
return statusCode.toString();
}
}
Cookies are important to the proper functioning of a site. To improve your experience, we use cookies to remember log-in details and provide secure log-in, collect statistics to optimize site functionality, and deliver content tailored to your interests. Click Agree and Proceed to accept cookies and go directly to the site or click on View Cookie Settings to see detailed descriptions of the types of cookies and choose whether to accept certain cookies while on the site.
About Author
Rupesh Sharma
Rupesh Sharma is a trainee here as an assistant consultant developer. His core interest is in java and posses good analytical and logical skills. He likes to learn new technology and will be to glad to get feedbacks for improvement.