Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

(REST API) Cannot create new customers from java project but can do it from postman request

Raul Reyes Monroy
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
June 14, 2019

I'm making a custom front-end to receive customer tickets for Service Desk (Cloud).

I use a Spring Boot project as a middleware to handle security using basic authentication.

I do my tests for Service Desk in postman before getting them to code.

Using this script in postman (https://myProjectSubdomain.atlassian.net/rest/servicedeskapi/request)

{
"serviceDeskId": "18",
"requestTypeId":"289",
"requestFieldValues": {
[...] a lot of custom fields, all correct,
"summary":"Request summary"
},
"raiseOnBehalfOf":"newCustomerMail@mail.com"
}

It works perfectly, the call returns the newly created request.

 

But when generating the same request in my java project (Spring boot, using Unirest to handle the REST calls) it returns a  HTTP 400 error with error message:

Your request could not be created. Please check the fields have been correctly filled in. Cannot add new customers.

I printed Unirest generated request and it is exactly the same as the one I put in postman.

 

Furthermore when I remove the part that adds the 'raiseOnBehalfOf' from my java code the request is correctly generated.

 

Why is it that I can create new users from postman and I can't do it from my java project?

 

1 answer

0 votes
shwa
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 23, 2019

What permissions does your java project have?

 

This is copied directly from the docs

The fields required for a customer request type depend on the user's permissions:

  • raiseOnBehalfOf is not available to Users who have the customer permission only.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events