How to make the first POST request after getting the Access Token from Oauth 1.0 verification?

I have enjoyed the joy of the success of Oauth 1.0 verification…for a minute. Then, I found that I cannot make POST request for the api request :frowning:

I use the sample code (Java) to have a search post request with the sample code here: [https://developer.atlassian.com/cloud/jira/platform/rest/v3/#api-api-3-search-post.\](https://developer.atlassian.com/cloud/jira/platform/rest/v3/#api-api-3-search-post.) I received errorMessages":[“Field ‘assignee’ does not exist or this field cannot be viewed by anonymous users.”]

Is there something I am missing? I have no idea about it. Do I need to add some header or param if I am authorized with Oauth?

The code below is my code:


package com.example.dao.jiraOauth;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.node.ArrayNode;
import com.fasterxml.jackson.databind.node.JsonNodeFactory;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.mashape.unirest.http.*;
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.JsonNode;
import com.mashape.unirest.http.Unirest;
import com.mashape.unirest.http.exceptions.UnirestException;

import java.io.IOException;

public class JiraPostRequest {

public static void main(String[] args){

// The payload definition using the Jackson library
JsonNodeFactory jnf = JsonNodeFactory.instance;
ObjectNode root = jnf.objectNode();
{
root.put("jql", "assignee=EMPTY");
root.put("startAt", 0);
root.put("maxResults", 15);
ArrayNode fields = root.putArray("fields");
fields.add("summary");
fields.add("status");
fields.add("assignee");
root.put("fieldsByKeys", false);
}

// Connect Jackson ObjectMapper to Unirest
Unirest.setObjectMapper(new ObjectMapper() {
private com.fasterxml.jackson.databind.ObjectMapper jacksonObjectMapper
= new com.fasterxml.jackson.databind.ObjectMapper();

public <T> T readValue(String value, Class<T> valueType) {
try {
return jacksonObjectMapper.readValue(value, valueType);
} catch (IOException e) {
throw new RuntimeException(e);
}
}

public String writeValue(Object value) {
try {
return jacksonObjectMapper.writeValueAsString(value);
} catch (JsonProcessingException e) {
throw new RuntimeException(e);
}
}
});

// This code sample uses the 'Unirest' library:
// [http://unirest.io/java.html\\](http://unirest.io/java.html/) HttpResponse<JsonNode> response = null;
try {
response = Unirest.post("https://abdc125.atlassian.net/rest/api/3/search") //This is not my real domain
.header("Accept", "application/json")
.header("Content-Type", "application/json")
.header("Bearer", "ZLr20vrEXxfXtBxZ7RNK7qKgPJabgxH3") //This is not my real access token 
.body(root)
.asJson();
} catch (UnirestException e) {
e.printStackTrace();
}

System.out.println(response.getBody());
}
}

And here is the result:


"C:\Program Files\Java\jdk1.8.0_181\bin\java.exe" "-javaagent:C:\Program Files\JetBrains\IntelliJ IDEA 2018.2.3\lib\idea_rt.jar=47328:C:\Program Files\JetBrains\IntelliJ IDEA 2018.2.3\bin" -Dfile.encoding=UTF-8 -classpath "C:\Program Files\Java\jdk1.8.0_181\jre\lib\charsets.jar;C:\Program Files\Java\jdk1.8.0_181\jre\lib\deploy.jar;C:\Program Files\Java\jdk1.8.0_181\jre\lib\ext\access-bridge-64.jar;C:\Program Files\Java\jdk1.8.0_181\jre\lib\ext\cldrdata.jar;C:\Program Files\Java\jdk1.8.0_181\jre\lib\ext\dnsns.jar;C:\Program Files\Java\jdk1.8.0_181\jre\lib\ext\jaccess.jar;C:\Program Files\Java\jdk1.8.0_181\jre\lib\ext\jfxrt.jar;C:\Program Files\Java\jdk1.8.0_181\jre\lib\ext\localedata.jar;C:\Program Files\Java\jdk1.8.0_181\jre\lib\ext\nashorn.jar;C:\Program Files\Java\jdk1.8.0_181\jre\lib\ext\sunec.jar;C:\Program Files\Java\jdk1.8.0_181\jre\lib\ext\sunjce_provider.jar;C:\Program Files\Java\jdk1.8.0_181\jre\lib\ext\sunmscapi.jar;C:\Program Files\Java\jdk1.8.0_181\jre\lib\ext\sunpkcs11.jar;C:\Program Files\Java\jdk1.8.0_181\jre\lib\ext\zipfs.jar;C:\Program Files\Java\jdk1.8.0_181\jre\lib\javaws.jar;C:\Program Files\Java\jdk1.8.0_181\jre\lib\jce.jar;C:\Program Files\Java\jdk1.8.0_181\jre\lib\jfr.jar;C:\Program Files\Java\jdk1.8.0_181\jre\lib\jfxswt.jar;C:\Program Files\Java\jdk1.8.0_181\jre\lib\jsse.jar;C:\Program Files\Java\jdk1.8.0_181\jre\lib\management-agent.jar;C:\Program Files\Java\jdk1.8.0_181\jre\lib\plugin.jar;C:\Program Files\Java\jdk1.8.0_181\jre\lib\resources.jar;C:\Program Files\Java\jdk1.8.0_181\jre\lib\rt.jar;D:\FilesMenu\Java\demo\target\classes;C:\Users\User\.m2\repository\org\springframework\spring-context-support\5.0.7.RELEASE\spring-context-support-5.0.7.RELEASE.jar;C:\Users\User\.m2\repository\org\springframework\spring-beans\5.0.7.RELEASE\spring-beans-5.0.7.RELEASE.jar;C:\Users\User\.m2\repository\org\springframework\spring-context\5.0.7.RELEASE\spring-context-5.0.7.RELEASE.jar;C:\Users\User\.m2\repository\org\springframework\spring-expression\5.0.7.RELEASE\spring-expression-5.0.7.RELEASE.jar;C:\Users\User\.m2\repository\org\springframework\spring-core\5.0.7.RELEASE\spring-core-5.0.7.RELEASE.jar;C:\Users\User\.m2\repository\org\springframework\spring-jcl\5.0.7.RELEASE\spring-jcl-5.0.7.RELEASE.jar;C:\Users\User\.m2\repository\org\springframework\boot\spring-boot-starter-data-jpa\2.0.3.RELEASE\spring-boot-starter-data-jpa-2.0.3.RELEASE.jar;C:\Users\User\.m2\repository\org\springframework\boot\spring-boot-starter\2.0.3.RELEASE\spring-boot-starter-2.0.3.RELEASE.jar;C:\Users\User\.m2\repository\org\springframework\boot\spring-boot\2.0.3.RELEASE\spring-boot-2.0.3.RELEASE.jar;C:\Users\User\.m2\repository\org\springframework\boot\spring-boot-autoconfigure\2.0.3.RELEASE\spring-boot-autoconfigure-2.0.3.RELEASE.jar;C:\Users\User\.m2\repository\org\springframework\boot\spring-boot-starter-logging\2.0.3.RELEASE\spring-boot-starter-logging-2.0.3.RELEASE.jar;C:\Users\User\.m2\repository\ch\qos\logback\logback-classic\1.2.3\logback-classic-1.2.3.jar;C:\Users\User\.m2\repository\ch\qos\logback\logback-core\1.2.3\logback-core-1.2.3.jar;C:\Users\User\.m2\repository\org\apache\logging\log4j\log4j-to-slf4j\2.10.0\log4j-to-slf4j-2.10.0.jar;C:\Users\User\.m2\repository\org\apache\logging\log4j\log4j-api\2.10.0\log4j-api-2.10.0.jar;C:\Users\User\.m2\repository\org\slf4j\jul-to-slf4j\1.7.25\jul-to-slf4j-1.7.25.jar;C:\Users\User\.m2\repository\javax\annotation\javax.annotation-api\1.3.2\javax.annotation-api-1.3.2.jar;C:\Users\User\.m2\repository\org\yaml\snakeyaml\1.19\snakeyaml-1.19.jar;C:\Users\User\.m2\repository\org\springframework\boot\spring-boot-starter-aop\2.0.3.RELEASE\spring-boot-starter-aop-2.0.3.RELEASE.jar;C:\Users\User\.m2\repository\org\aspectj\aspectjweaver\1.8.13\aspectjweaver-1.8.13.jar;C:\Users\User\.m2\repository\org\hibernate\hibernate-core\5.2.17.Final\hibernate-core-5.2.17.Final.jar;C:\Users\User\.m2\repository\org\jboss\logging\jboss-logging\3.3.2.Final\jboss-logging-3.3.2.Final.jar;C:\Users\User\.m2\repository\org\hibernate\javax\persistence\hibernate-jpa-2.1-api\1.0.2.Final\hibernate-jpa-2.1-api-1.0.2.Final.jar;C:\Users\User\.m2\repository\org\javassist\javassist\3.22.0-GA\javassist-3.22.0-GA.jar;C:\Users\User\.m2\repository\antlr\antlr\2.7.7\antlr-2.7.7.jar;C:\Users\User\.m2\repository\org\jboss\jandex\2.0.3.Final\jandex-2.0.3.Final.jar;C:\Users\User\.m2\repository\com\fasterxml\classmate\1.3.4\classmate-1.3.4.jar;C:\Users\User\.m2\repository\dom4j\dom4j\1.6.1\dom4j-1.6.1.jar;C:\Users\User\.m2\repository\org\hibernate\common\hibernate-commons-annotations\5.0.1.Final\hibernate-commons-annotations-5.0.1.Final.jar;C:\Users\User\.m2\repository\javax\transaction\javax.transaction-api\1.2\javax.transaction-api-1.2.jar;C:\Users\User\.m2\repository\org\springframework\data\spring-data-jpa\2.0.8.RELEASE\spring-data-jpa-2.0.8.RELEASE.jar;C:\Users\User\.m2\repository\org\springframework\data\spring-data-commons\2.0.8.RELEASE\spring-data-commons-2.0.8.RELEASE.jar;C:\Users\User\.m2\repository\org\springframework\spring-orm\5.0.7.RELEASE\spring-orm-5.0.7.RELEASE.jar;C:\Users\User\.m2\repository\org\springframework\spring-tx\5.0.7.RELEASE\spring-tx-5.0.7.RELEASE.jar;C:\Users\User\.m2\repository\org\slf4j\slf4j-api\1.7.25\slf4j-api-1.7.25.jar;C:\Users\User\.m2\repository\org\springframework\spring-aspects\5.0.7.RELEASE\spring-aspects-5.0.7.RELEASE.jar;C:\Users\User\.m2\repository\org\springframework\boot\spring-boot-starter-data-redis\2.0.3.RELEASE\spring-boot-starter-data-redis-2.0.3.RELEASE.jar;C:\Users\User\.m2\repository\org\springframework\data\spring-data-redis\2.0.8.RELEASE\spring-data-redis-2.0.8.RELEASE.jar;C:\Users\User\.m2\repository\org\springframework\data\spring-data-keyvalue\2.0.8.RELEASE\spring-data-keyvalue-2.0.8.RELEASE.jar;C:\Users\User\.m2\repository\org\springframework\spring-oxm\5.0.7.RELEASE\spring-oxm-5.0.7.RELEASE.jar;C:\Users\User\.m2\repository\io\lettuce\lettuce-core\5.0.4.RELEASE\lettuce-core-5.0.4.RELEASE.jar;C:\Users\User\.m2\repository\io\projectreactor\reactor-core\3.1.8.RELEASE\reactor-core-3.1.8.RELEASE.jar;C:\Users\User\.m2\repository\org\reactivestreams\reactive-streams\1.0.2\reactive-streams-1.0.2.jar;C:\Users\User\.m2\repository\io\netty\netty-common\4.1.25.Final\netty-common-4.1.25.Final.jar;C:\Users\User\.m2\repository\io\netty\netty-transport\4.1.25.Final\netty-transport-4.1.25.Final.jar;C:\Users\User\.m2\repository\io\netty\netty-buffer\4.1.25.Final\netty-buffer-4.1.25.Final.jar;C:\Users\User\.m2\repository\io\netty\netty-resolver\4.1.25.Final\netty-resolver-4.1.25.Final.jar;C:\Users\User\.m2\repository\io\netty\netty-handler\4.1.25.Final\netty-handler-4.1.25.Final.jar;C:\Users\User\.m2\repository\io\netty\netty-codec\4.1.25.Final\netty-codec-4.1.25.Final.jar;C:\Users\User\.m2\repository\org\springframework\boot\spring-boot-starter-data-redis-reactive\2.0.3.RELEASE\spring-boot-starter-data-redis-reactive-2.0.3.RELEASE.jar;C:\Users\User\.m2\repository\org\springframework\boot\spring-boot-starter-jdbc\2.0.3.RELEASE\spring-boot-starter-jdbc-2.0.3.RELEASE.jar;C:\Users\User\.m2\repository\com\zaxxer\HikariCP\2.7.9\HikariCP-2.7.9.jar;C:\Users\User\.m2\repository\org\springframework\spring-jdbc\5.0.7.RELEASE\spring-jdbc-5.0.7.RELEASE.jar;C:\Users\User\.m2\repository\org\springframework\boot\spring-boot-starter-thymeleaf\2.0.3.RELEASE\spring-boot-starter-thymeleaf-2.0.3.RELEASE.jar;C:\Users\User\.m2\repository\org\thymeleaf\thymeleaf-spring5\3.0.9.RELEASE\thymeleaf-spring5-3.0.9.RELEASE.jar;C:\Users\User\.m2\repository\org\thymeleaf\thymeleaf\3.0.9.RELEASE\thymeleaf-3.0.9.RELEASE.jar;C:\Users\User\.m2\repository\org\attoparser\attoparser\2.0.4.RELEASE\attoparser-2.0.4.RELEASE.jar;C:\Users\User\.m2\repository\org\unbescape\unbescape\1.1.5.RELEASE\unbescape-1.1.5.RELEASE.jar;C:\Users\User\.m2\repository\org\thymeleaf\extras\thymeleaf-extras-java8time\3.0.1.RELEASE\thymeleaf-extras-java8time-3.0.1.RELEASE.jar;C:\Users\User\.m2\repository\org\springframework\boot\spring-boot-starter-web\2.0.3.RELEASE\spring-boot-starter-web-2.0.3.RELEASE.jar;C:\Users\User\.m2\repository\org\springframework\boot\spring-boot-starter-json\2.0.3.RELEASE\spring-boot-starter-json-2.0.3.RELEASE.jar;C:\Users\User\.m2\repository\com\fasterxml\jackson\core\jackson-databind\2.9.6\jackson-databind-2.9.6.jar;C:\Users\User\.m2\repository\com\fasterxml\jackson\core\jackson-annotations\2.9.0\jackson-annotations-2.9.0.jar;C:\Users\User\.m2\repository\com\fasterxml\jackson\datatype\jackson-datatype-jdk8\2.9.6\jackson-datatype-jdk8-2.9.6.jar;C:\Users\User\.m2\repository\com\fasterxml\jackson\datatype\jackson-datatype-jsr310\2.9.6\jackson-datatype-jsr310-2.9.6.jar;C:\Users\User\.m2\repository\com\fasterxml\jackson\module\jackson-module-parameter-names\2.9.6\jackson-module-parameter-names-2.9.6.jar;C:\Users\User\.m2\repository\org\springframework\boot\spring-boot-starter-tomcat\2.0.3.RELEASE\spring-boot-starter-tomcat-2.0.3.RELEASE.jar;C:\Users\User\.m2\repository\org\apache\tomcat\embed\tomcat-embed-core\8.5.31\tomcat-embed-core-8.5.31.jar;C:\Users\User\.m2\repository\org\apache\tomcat\embed\tomcat-embed-el\8.5.31\tomcat-embed-el-8.5.31.jar;C:\Users\User\.m2\repository\org\apache\tomcat\embed\tomcat-embed-websocket\8.5.31\tomcat-embed-websocket-8.5.31.jar;C:\Users\User\.m2\repository\org\hibernate\validator\hibernate-validator\6.0.10.Final\hibernate-validator-6.0.10.Final.jar;C:\Users\User\.m2\repository\javax\validation\validation-api\2.0.1.Final\validation-api-2.0.1.Final.jar;C:\Users\User\.m2\repository\org\springframework\spring-web\5.0.7.RELEASE\spring-web-5.0.7.RELEASE.jar;C:\Users\User\.m2\repository\org\springframework\spring-webmvc\5.0.7.RELEASE\spring-webmvc-5.0.7.RELEASE.jar;C:\Users\User\.m2\repository\org\springframework\boot\spring-boot-starter-security\2.0.3.RELEASE\spring-boot-starter-security-2.0.3.RELEASE.jar;C:\Users\User\.m2\repository\org\springframework\spring-aop\5.0.7.RELEASE\spring-aop-5.0.7.RELEASE.jar;C:\Users\User\.m2\repository\org\springframework\security\spring-security-config\5.0.6.RELEASE\spring-security-config-5.0.6.RELEASE.jar;C:\Users\User\.m2\repository\org\springframework\security\spring-security-core\5.0.6.RELEASE\spring-security-core-5.0.6.RELEASE.jar;C:\Users\User\.m2\repository\org\springframework\security\spring-security-web\5.0.6.RELEASE\spring-security-web-5.0.6.RELEASE.jar;C:\Users\User\.m2\repository\com\h2database\h2\1.4.197\h2-1.4.197.jar;C:\Users\User\.m2\repository\com\microsoft\sqlserver\mssql-jdbc\6.2.2.jre8\mssql-jdbc-6.2.2.jre8.jar;C:\Users\User\.m2\repository\mysql\mysql-connector-java\5.1.46\mysql-connector-java-5.1.46.jar;C:\Users\User\.m2\repository\com\google\collections\google-collections\1.0\google-collections-1.0.jar;C:\Users\User\.m2\repository\com\google\oauth-client\google-oauth-client\1.22.0\google-oauth-client-1.22.0.jar;C:\Users\User\.m2\repository\com\google\http-client\google-http-client\1.22.0\google-http-client-1.22.0.jar;C:\Users\User\.m2\repository\com\google\code\findbugs\jsr305\1.3.9\jsr305-1.3.9.jar;C:\Users\User\.m2\repository\com\google\http-client\google-http-client-jackson2\1.11.0-beta\google-http-client-jackson2-1.11.0-beta.jar;C:\Users\User\.m2\repository\com\fasterxml\jackson\core\jackson-core\2.9.6\jackson-core-2.9.6.jar;C:\Users\User\.m2\repository\org\json\json\20160810\json-20160810.jar;C:\Users\User\.m2\repository\com\mashape\unirest\unirest-java\1.4.9\unirest-java-1.4.9.jar;C:\Users\User\.m2\repository\org\apache\httpcomponents\httpclient\4.3.6\httpclient-4.3.6.jar;C:\Users\User\.m2\repository\org\apache\httpcomponents\httpcore\4.4.9\httpcore-4.4.9.jar;C:\Users\User\.m2\repository\commons-codec\commons-codec\1.11\commons-codec-1.11.jar;C:\Users\User\.m2\repository\org\apache\httpcomponents\httpasyncclient\4.0.2\httpasyncclient-4.0.2.jar;C:\Users\User\.m2\repository\org\apache\httpcomponents\httpcore-nio\4.4.9\httpcore-nio-4.4.9.jar;C:\Users\User\.m2\repository\org\apache\httpcomponents\httpmime\4.3.6\httpmime-4.3.6.jar" com.example.dao.jiraOauth.JiraPostRequest
02:01:08.052 [main] DEBUG org.apache.http.client.protocol.RequestAddCookies - CookieSpec selected: best-match
02:01:08.074 [main] DEBUG org.apache.http.client.protocol.RequestAuthCache - Auth cache not set in the context
02:01:08.077 [main] DEBUG org.apache.http.impl.conn.PoolingHttpClientConnectionManager - Connection request: [route: {s}->[https://vgadmin.atlassian.net:443][total](https://vgadmin.atlassian.net:443][total/) kept alive: 0; route allocated: 0 of 20; total allocated: 0 of 200]
02:01:08.114 [main] DEBUG org.apache.http.impl.conn.PoolingHttpClientConnectionManager - Connection leased: [id: 0][route: {s}->[https://vgadmin.atlassian.net:443][total](https://vgadmin.atlassian.net:443][total/) kept alive: 0; route allocated: 1 of 20; total allocated: 1 of 200]
02:01:08.116 [main] DEBUG org.apache.http.impl.execchain.MainClientExec - Opening connection {s}->[https://vgadmin.atlassian.net:443\\](https://vgadmin.atlassian.net/) 02:01:08.170 [main] DEBUG org.apache.http.impl.conn.HttpClientConnectionOperator - Connecting to vgadmin.atlassian.net/13.236.8.128:443
02:01:09.154 [main] DEBUG org.apache.http.impl.conn.HttpClientConnectionOperator - Connection established 0:0:0:0:0:0:0:1:47337<->13.236.8.128:443
02:01:09.154 [main] DEBUG org.apache.http.impl.execchain.MainClientExec - Executing request POST /rest/api/3/search HTTP/1.1
02:01:09.154 [main] DEBUG org.apache.http.impl.execchain.MainClientExec - Target auth state: UNCHALLENGED
02:01:09.154 [main] DEBUG org.apache.http.impl.execchain.MainClientExec - Proxy auth state: UNCHALLENGED
02:01:09.156 [main] DEBUG org.apache.http.headers - http-outgoing-0 >> POST /rest/api/3/search HTTP/1.1
02:01:09.156 [main] DEBUG org.apache.http.headers - http-outgoing-0 >> Accept: application/json
02:01:09.156 [main] DEBUG org.apache.http.headers - http-outgoing-0 >> accept-encoding: gzip
02:01:09.156 [main] DEBUG org.apache.http.headers - http-outgoing-0 >> Bearer: ZLr20vrEXxfXtBxZ7RNK1wKgPJbdgxT5
02:01:09.156 [main] DEBUG org.apache.http.headers - http-outgoing-0 >> Content-Type: application/json
02:01:09.156 [main] DEBUG org.apache.http.headers - http-outgoing-0 >> user-agent: unirest-java/1.3.11
02:01:09.156 [main] DEBUG org.apache.http.headers - http-outgoing-0 >> Content-Length: 114
02:01:09.156 [main] DEBUG org.apache.http.headers - http-outgoing-0 >> Host: vgadmin.atlassian.net
02:01:09.156 [main] DEBUG org.apache.http.headers - http-outgoing-0 >> Connection: Keep-Alive
02:01:09.156 [main] DEBUG org.apache.http.wire - http-outgoing-0 >> "POST /rest/api/3/search HTTP/1.1[\r][\n]"
02:01:09.156 [main] DEBUG org.apache.http.wire - http-outgoing-0 >> "Accept: application/json[\r][\n]"
02:01:09.156 [main] DEBUG org.apache.http.wire - http-outgoing-0 >> "accept-encoding: gzip[\r][\n]"
02:01:09.156 [main] DEBUG org.apache.http.wire - http-outgoing-0 >> "Bearer: ZLr20vrEXxfXtBxZ7RNK1wKgPJbdgxT5[\r][\n]"
02:01:09.157 [main] DEBUG org.apache.http.wire - http-outgoing-0 >> "Content-Type: application/json[\r][\n]"
02:01:09.157 [main] DEBUG org.apache.http.wire - http-outgoing-0 >> "user-agent: unirest-java/1.3.11[\r][\n]"
02:01:09.157 [main] DEBUG org.apache.http.wire - http-outgoing-0 >> "Content-Length: 114[\r][\n]"
02:01:09.157 [main] DEBUG org.apache.http.wire - http-outgoing-0 >> "Host: vgadmin.atlassian.net[\r][\n]"
02:01:09.157 [main] DEBUG org.apache.http.wire - http-outgoing-0 >> "Connection: Keep-Alive[\r][\n]"
02:01:09.157 [main] DEBUG org.apache.http.wire - http-outgoing-0 >> "[\r][\n]"
02:01:09.157 [main] DEBUG org.apache.http.wire - http-outgoing-0 >> "{"jql":"assignee=EMPTY","startAt":0,"maxResults":15,"fields":["summary","status","assignee"],"fieldsByKeys":false}"
02:01:09.579 [main] DEBUG org.apache.http.wire - http-outgoing-0 << "HTTP/1.1 400 [\r][\n]"
02:01:09.579 [main] DEBUG org.apache.http.wire - http-outgoing-0 << "Server: Atlassian Proxy/1.13.6.2[\r][\n]"
02:01:09.579 [main] DEBUG org.apache.http.wire - http-outgoing-0 << "Cache-Control: no-cache, no-store, no-transform[\r][\n]"
02:01:09.579 [main] DEBUG org.apache.http.wire - http-outgoing-0 << "Content-Type: application/json;charset=UTF-8[\r][\n]"
02:01:09.579 [main] DEBUG org.apache.http.wire - http-outgoing-0 << "Strict-Transport-Security: max-age=315360000; includeSubDomains; preload[\r][\n]"
02:01:09.579 [main] DEBUG org.apache.http.wire - http-outgoing-0 << "Date: Thu, 11 Oct 2018 18:01:09 GMT[\r][\n]"
02:01:09.579 [main] DEBUG org.apache.http.wire - http-outgoing-0 << "ATL-TraceId: 8ae0f555db0d52af[\r][\n]"
02:01:09.579 [main] DEBUG org.apache.http.wire - http-outgoing-0 << "X-AREQUESTID: 8e0e688b-1443-48d3-b91a-cf52eb23623c[\r][\n]"
02:01:09.579 [main] DEBUG org.apache.http.wire - http-outgoing-0 << "X-XSS-Protection: 1; mode=block[\r][\n]"
02:01:09.579 [main] DEBUG org.apache.http.wire - http-outgoing-0 << "Transfer-Encoding: chunked[\r][\n]"
02:01:09.579 [main] DEBUG org.apache.http.wire - http-outgoing-0 << "ATL-TCS-Time: Cache Hit[\r][\n]"
02:01:09.584 [main] DEBUG org.apache.http.wire - http-outgoing-0 << "X-AUSERNAME: anonymous[\r][\n]"
02:01:09.584 [main] DEBUG org.apache.http.wire - http-outgoing-0 << "X-Content-Type-Options: nosniff[\r][\n]"
02:01:09.584 [main] DEBUG org.apache.http.wire - http-outgoing-0 << "Connection: close[\r][\n]"
02:01:09.584 [main] DEBUG org.apache.http.wire - http-outgoing-0 << "Set-Cookie: atlassian.xsrf.token=BTQA-8GX6-UNY7-QJ5P_edb99161740e493e7e5038643c8612dd69d7a4ff_lout; Path=/; Secure[\r][\n]"
02:01:09.584 [main] DEBUG org.apache.http.wire - http-outgoing-0 << "[\r][\n]"
02:01:09.584 [main] DEBUG org.apache.http.wire - http-outgoing-0 << "7d[\r][\n]"
02:01:09.584 [main] DEBUG org.apache.http.wire - http-outgoing-0 << "{"errorMessages":["Field 'assignee' does not exist or this field cannot be viewed by anonymous users."],"warningMessages":[]}[\r][\n]"
02:01:09.586 [main] DEBUG org.apache.http.headers - http-outgoing-0 << HTTP/1.1 400 
02:01:09.587 [main] DEBUG org.apache.http.headers - http-outgoing-0 << Server: Atlassian Proxy/1.13.6.2
02:01:09.587 [main] DEBUG org.apache.http.headers - http-outgoing-0 << Cache-Control: no-cache, no-store, no-transform
02:01:09.587 [main] DEBUG org.apache.http.headers - http-outgoing-0 << Content-Type: application/json;charset=UTF-8
02:01:09.587 [main] DEBUG org.apache.http.headers - http-outgoing-0 << Strict-Transport-Security: max-age=315360000; includeSubDomains; preload
02:01:09.587 [main] DEBUG org.apache.http.headers - http-outgoing-0 << Date: Thu, 11 Oct 2018 18:01:09 GMT
02:01:09.587 [main] DEBUG org.apache.http.headers - http-outgoing-0 << ATL-TraceId: 8ae0f555db0d52af
02:01:09.587 [main] DEBUG org.apache.http.headers - http-outgoing-0 << X-AREQUESTID: 8e0e688b-1443-48d3-b91a-cf52eb23623c
02:01:09.587 [main] DEBUG org.apache.http.headers - http-outgoing-0 << X-XSS-Protection: 1; mode=block
02:01:09.587 [main] DEBUG org.apache.http.headers - http-outgoing-0 << Transfer-Encoding: chunked
02:01:09.587 [main] DEBUG org.apache.http.headers - http-outgoing-0 << ATL-TCS-Time: Cache Hit
02:01:09.587 [main] DEBUG org.apache.http.headers - http-outgoing-0 << X-AUSERNAME: anonymous
02:01:09.587 [main] DEBUG org.apache.http.headers - http-outgoing-0 << X-Content-Type-Options: nosniff
02:01:09.587 [main] DEBUG org.apache.http.headers - http-outgoing-0 << Connection: close
02:01:09.587 [main] DEBUG org.apache.http.headers - http-outgoing-0 << Set-Cookie: atlassian.xsrf.token=BTQA-8GX6-UNY7-QJ5P_edb99161740e493e7e5038643c8612dd69d7a4ff_lout; Path=/; Secure
02:01:09.597 [main] DEBUG org.apache.http.client.protocol.ResponseProcessCookies - Cookie accepted [atlassian.xsrf.token="BTQA-8GX6-UNY7-QJ5P_edb99161740e493e7e5038643c8612dd69d7a4ff_lout", version:0, domain:vgadmin.atlassian.net, path:/, expiry:null]
02:01:09.600 [main] DEBUG org.apache.http.wire - http-outgoing-0 << "0[\r][\n]"
02:01:09.600 [main] DEBUG org.apache.http.wire - http-outgoing-0 << "[\r][\n]"
02:01:09.600 [main] DEBUG org.apache.http.impl.conn.DefaultManagedHttpClientConnection - http-outgoing-0: Shutdown connection
02:01:09.601 [main] DEBUG org.apache.http.impl.execchain.MainClientExec - Connection discarded
02:01:09.601 [main] DEBUG org.apache.http.impl.conn.DefaultManagedHttpClientConnection - http-outgoing-0: Close connection
02:01:09.602 [main] DEBUG org.apache.http.impl.conn.PoolingHttpClientConnectionManager - Connection released: [id: 0][route: {s}->[https://vgadmin.atlassian.net:443][total](https://vgadmin.atlassian.net:443][total/) kept alive: 0; route allocated: 0 of 20; total allocated: 0 of 200]
02:01:09.607 [main] DEBUG org.apache.http.impl.execchain.MainClientExec - Cancelling request execution
{"errorMessages":["Field 'assignee' does not exist or this field cannot be viewed by anonymous users."],"warningMessages":[]}

Process finished with exit code 0

A bit too late but maybe it will help someone else.

As the error message says, the authentication fails for your Java code and therefore the call is executed as anonymous:

“Field ‘assignee’ does not exist or this field cannot be viewed by anonymous users.”

This is because the header for Bearer authentication is not correct. In the provided code it is:
header("Bearer", "ZLr20vrEXxfXtBxZ7RNK7qKgPJabgxH3")

While it should be:
header("Authorization", "Bearer ZLr20vrEXxfXtBxZ7RNK7qKgPJabgxH3")