<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none"><!-- p { margin-top: 0px; margin-bottom: 0px; } p.MsoNormal, li.MsoNormal, div.MsoNormal { margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif; } span.EmailStyle17 { font-family: Calibri, sans-serif; color: windowtext; } .MsoChpDefault { font-family: Calibri, sans-serif; }--></style>
</head>
<body dir="ltr" style="font-size:12pt;color:#000000;background-color:#FFFFFF;font-family:Calibri,Arial,Helvetica,sans-serif;">
<p>​My fault. Actually I use <greater><br>
</p>
<p><br>
</p>
<div id="Signature">
<div style="font-family:Tahoma; font-size:13px">
<div style="font-family:Tahoma; font-size:13px">
<div style="font-family:Tahoma; font-size:13px">
<div style="font-family:Tahoma; font-size:13px">
<div style="font-family:Tahoma; font-size:13px"><font size="3"><b style="font-family:Times New Roman"><span style="font-size:10pt; color:rgb(31,73,125)">Paulo Fernandes de Souza Júnior</span></b><b style="font-family:Times New Roman"><span style="font-size:10pt; color:rgb(23,54,93)"></span></b><span style="font-family:Times New Roman">
</span><br style="font-family:Times New Roman">
<b style="font-family:Times New Roman"><span style="font-size:8pt; color:rgb(31,73,125)">NQPPPS<br>
</span></b><span style="font-size:8pt; font-family:Times New Roman; color:rgb(23,54,93)">Senado Federal -
</span></font><font size="3"><span style="font-size:8pt; font-family:Times New Roman; color:rgb(31,73,125)">PRODASEN<br>
</span><span style="font-size:8pt; font-family:Times New Roman; color:rgb(23,54,93)">Fone: 61 3303.3924</span></font><span style="color:rgb(31,73,125)"></span>
<br>
<br>
<p class="MsoNormal"><br>
</p>
</div>
</div>
</div>
</div>
</div>
</div>
<div style="color: rgb(33, 33, 33);">
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>De:</b> midPoint <midpoint-bounces@lists.evolveum.com> em nome de Richard Richter via midPoint <midpoint@lists.evolveum.com><br>
<b>Enviado:</b> quinta-feira, 11 de novembro de 2021 10:03<br>
<b>Para:</b> midPoint General Discussion<br>
<b>Cc:</b> Richard Richter<br>
<b>Assunto:</b> Re: [midPoint] Midpoint Query API</font>
<div> </div>
</div>
<div>
<div style="font-family:arial,helvetica,sans-serif; font-size:12pt; color:#000000">
<div>Hi<br>
</div>
<div><br>
</div>
<div>I was confused from "whenCreated" attribute so I rather didn't answer, however, if indeed metadata/createTimestamp (or modifyTimestamp) are meant, then sure, these are indexed in DB and available for query against repository.<br>
</div>
<div>However, these are timestamps and <equal> with date is virtually sure to return nothing (not sure about all DBs, but conceptually it should not).<br>
</div>
<div>For example, to find users created on 2021-11-11, use this instead:<br>
</div>
<div><br>
</div>
<div><query><br>
  <filter><br>
    <and><br>
      <greaterOrEqual><br>
        <path>metadata/createTimestamp</path><br>
        <value>2021-11-11</value><br>
      </greaterOrEqual><br>
      <less><br>
        <path>metadata/createTimestamp</path><br>
        <value>2021-11-12</value><br>
      </less><br>
    </and><br>
  </filter><br>
</query><br>
</div>
<div><br>
</div>
<div>This results in proper HQL query:<br>
</div>
<div>select<br>
  u.oid,<br>
  u.fullObject<br>
from<br>
  RUser u<br>
where<br>
  (<br>
    u.createTimestamp >= :createTimestamp and<br>
    u.createTimestamp < :createTimestamp2<br>
  )<br>
</div>
<div><br>
</div>
<div>Parameters are expanded to complete timestamps at midnight (also, the timezone can be an issue, depending on the TZ of your DB too):<br>
</div>
<div>createTimestamp2 = 2021-11-12T00:00:00.000Z<br>
createTimestamp = 2021-11-11T00:00:00.000Z<br>
</div>
<div><br>
</div>
<div>It is always preferable to use >= and < combination for timestamps in queries.<br>
</div>
<div><br>
</div>
<div>This can be tested in Query playground, the one-but-last main menu item, just above About. More info about Query API here:
<a href="https://docs.evolveum.com/midpoint/reference/concepts/query/query-api/">
https://docs.evolveum.com/midpoint/reference/concepts/query/query-api/</a><br>
</div>
<div><br>
</div>
<div>Cheers<br>
</div>
<div><br>
</div>
<div>Richard Richter<br>
</div>
<div>Evolveum SW Developer<br>
</div>
<hr id="zwchr">
<div><b>From: </b>"midPoint General Discussion" <midpoint@lists.evolveum.com><br>
<b>To: </b>"midPoint General Discussion" <midpoint@lists.evolveum.com><br>
<b>Cc: </b>"Paulo Fernandes de Souza Junior" <PFSJ@senado.leg.br><br>
<b>Sent: </b>Thursday, November 11, 2021 12:50:14 PM<br>
<b>Subject: </b>Re: [midPoint] Midpoint Query API<br>
</div>
<div><br>
<style style="">
<!--
p
        {margin-top:0.0px;
        margin-bottom:0.0px}
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0.0in;
        font-size:11.0pt;
        font-family:Calibri ,sans-serif}
span.EmailStyle17
        {font-family:Calibri ,sans-serif;
        color:windowtext}
*.MsoChpDefault
        {font-family:Calibri ,sans-serif}
-->
</style></div>
<div>
<p>You can use:<br>
</p>
<p><br>
</p>
<p><query><br>
</p>
<p>  <filter><br>
</p>
<p>    <equal><br>
</p>
<p>      <path>metadata/createTimestamp</path><br>
</p>
<p>      <value>2021-07-20</value><br>
</p>
<p>    </equal><br>
</p>
<p>  </filter><br>
</p>
<p></query><br>
</p>
<p><br>
</p>
<p>Or <path>metadata/modifyTimestamp</path><br>
</p>
<p><br>
</p>
<p>[]s,<br>
</p>
<p><br>
</p>
<div id="Signature">
<div style="font-family:'tahoma'; font-size:13px">
<div style="font-family:'tahoma'; font-size:13px">
<div style="font-family:'tahoma'; font-size:13px">
<div style="font-family:'tahoma'; font-size:13px">
<div style="font-family:'tahoma'; font-size:13px"><br>
</div>
<div style="font-family:'tahoma'; font-size:13px"><font size="3"><b style="font-family:'times new roman'"><span style="font-size:10pt; color:rgb(31 ,73 ,125)"><br>
</span></b></font></div>
<div style="font-family:'tahoma'; font-size:13px"><font size="3"><b style="font-family:'times new roman'"><span style="font-size:10pt; color:rgb(31 ,73 ,125)">Paulo Fernandes de Souza Júnior</span></b><b style="font-family:'times new roman'"><span style="font-size:10pt; color:rgb(23 ,54 ,93)"></span></b><span style="font-family:'times new roman'">
</span><br style="font-family:'times new roman'">
<b style="font-family:'times new roman'"><span style="font-size:8pt; color:rgb(31 ,73 ,125)">NQPPPS<br>
</span></b><span style="font-size:8pt; font-family:'times new roman'; color:rgb(23 ,54 ,93)">Senado Federal -
</span></font><font size="3"><span style="font-size:8pt; font-family:'times new roman'; color:rgb(31 ,73 ,125)">PRODASEN<br>
</span><span style="font-size:8pt; font-family:'times new roman'; color:rgb(23 ,54 ,93)">Fone: 61 3303.3924</span></font><span style="color:rgb(31 ,73 ,125)"></span>
<br>
<br>
<p class="MsoNormal"><br>
</p>
</div>
</div>
</div>
</div>
</div>
</div>
<div style="word-wrap:break-word">
<hr style="display:inline-block; width:98%">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>De:</b> midPoint <midpoint-bounces@lists.evolveum.com> em nome de Jérôme ROGER via midPoint <midpoint@lists.evolveum.com><br>
<b>Enviado:</b> quarta-feira, 10 de novembro de 2021 12:41<br>
<b>Para:</b> midpoint@lists.evolveum.com<br>
<b>Cc:</b> Jérôme ROGER<br>
<b>Assunto:</b> [midPoint] Midpoint Query API</font>
<div> </div>
</div>
<div>
<div class="WordSection1">
<p class="MsoNormal">hello,</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">I am running midpoint 4.0.2 and for a new Hr software, I need to query the midpoint database to get all users by querying the attributes whenCreated and WhenChanged. I've tried with query Api with no success. I'd like to know if those attributes
 are requestable or if a better solution exists.<br>
</p>
<p class="MsoNormal">Thank you for your help.</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">Best regards,</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">Jerome</p>
</div>
</div>
</div>
<br>
_______________________________________________<br>
midPoint mailing list<br>
midPoint@lists.evolveum.com<br>
https://lists.evolveum.com/mailman/listinfo/midpoint<br>
</div>
</div>
</div>
</div>
</body>
</html>