Hi,
I create an application in which I can see how many hours users have logged in. For this I have to carry out the next following jql request via the REST API.
worklogDate >= "2018/03/26" && worklogDate <= "2018/03/30" ORDER BY key ASC
I wrote this code
require 'config.php';
$ch = curl_init( atlassinaURL.'/rest/api/2/search/?jql=worklogDate%20%3E%3D%20%222018%2F03%2F26%22%20%26%26%20worklogDate%20%3C%3D%20%222018%2F03%2F30%22%20ORDER%20BY%20key%20ASC');
$jsonData = array(
'username' => JiraUser,
'password' => JiraPass );
$jsonDataEncoded = json_encode($jsonData);
curl_setopt($ch, CURLOPT_POSTFIELDS, $jsonDataEncoded);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
$result = curl_exec($ch);
curl_close($ch);
$sess_arr = json_decode($result, true);
if(isset($sess_arr['errorMessages'][0])) {
echo $sess_arr['errorMessages'][0];
}else {
var_dump($sess_arr);
}
When I call this page, I get the following message back
Unrecognized field "username" (Class com.atlassian.jira.rest.v2.search.SearchRequestBean), not marked as ignorable
at [Source: org.apache.catalina.connector.CoyoteInputStream@3f8b53db; line: 1, column: 14] (through reference chain: com.atlassian.jira.rest.v2.search.SearchRequestBean["username"])
I searched the internet, but I did not find the solution. Can you help me?
Your post is sending the user name and password as though they are on-screen fields.
They are not fields, they are data for authentication. Please have a read of https://developer.atlassian.com/server/jira/platform/rest-apis/ concentrating on the authentication sections
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.