How I can change the REST API timezone to be consistent with my CMIS queries results?

cancel
Showing results for 
Search instead for 
Did you mean: 
ahmedsafwat
Member II

How I can change the REST API timezone to be consistent with my CMIS queries results?

I am using Alfresco Enterprise 5.2 and CMIS 1.1. I do CMIS queries and it returns the right timezone EST but when I use the REST API it always returns UTC. How I can change the REST API timezone to be consistent with my CMIS queries results?

5 Replies
andy1
Senior Member

Re: How I can change the REST API timezone to be consistent with my CMIS queries results?

Hi

CMIS queries can be executed in many ways. What exactly are you comparing? The same query via the CMIS browser binding  CMIS QL using the public search API? I believe the public API defines how dates are returned somewhere.

Can you give the example query?

Andy

ivanovpavel1983
Active Member

Re: How I can change the REST API timezone to be consistent with my CMIS queries results?

We have the same problem with REST API v1:

But openDate is 2017-12-27!!!

The same with BirthDate:

Real birthdate is 01.01.1988!!

The datatype is date:

This is inadequate behaviour of Alfresco Rest API (get nodes, search api) ((

Does anyone known how to fix this case/error?

ajkr195
Customer

Re: How I can change the REST API timezone to be consistent with my CMIS queries results?

I am running into same issue. Not sure why Alfresco (may be Hyland will) put something short and precise help documentation for such small things. I am book-marking this thread and hoping some expert will provide some expert comment on this. 

EddieMay
Alfresco Employee

Re: How I can change the REST API timezone to be consistent with my CMIS queries results?

Hi @ajkr195 

Have you submitted a suport request to look into this?

Cheers,

Digital Community Manager, Alfresco Software.
Problem solved? Click Accept as Solution!
abhinavmishra14
Advanced

Re: How I can change the REST API timezone to be consistent with my CMIS queries results?


@ivanovpavel1983 wrote:

We have the same problem with REST API v1:

 

But openDate is 2017-12-27!!!

The same with BirthDate:

Real birthdate is 01.01.1988!!

The datatype is date:

 

 

This is inadequate behaviour of Alfresco Rest API (get nodes, search api) ((

Does anyone known how to fix this case/error?


ACS runs in UTC time zone by default. Even for d:date type the values are stored as timestamps but time values after date remains all 0s. We change/sync acs/share/solr/db etc. server time zones based on specific requirements if there is a need to keep the server in a specific time zone.

otp:agreementOpenDate seems to be using d:dateTime as data type as i can see a time fragment in the value. And otp:birthDate is mapped to d:date as per your screenshot. It is strage to see this value after date: "T21:00:00.000+0000", for date type values are saved as "T00:00:00.000+0000", not sure why there is a time in the values you have mentioned.

However, I tried to replicate the issue and i could not see the issue you have mentioned.

I tried date as '01.01.1988' and '2017-12-27'. 

Used this docker compose to test this issue: https://github.com/Alfresco/acs-community-deployment/blob/master/docker-compose/docker-compose.yml#L...

I created below aspect via Model manager and applied it on some nodes for testing:

<aspect name="dt:dateTestAspect">
            <title>dtAspect</title>
            <properties>
                <property name="dt:birthDate">
                    <title>BirthDate</title>
                    <type>d:date</type>
                    <mandatory>false</mandatory>
                    <index enabled="true">
                        <tokenised>true</tokenised>
                    </index>
                </property>
            </properties>
        </aspect>

When i get metadata for node: workspace://SpacesStore/7c1df281-c7f9-45bc-b0a7-21ab6fd2ac0b

http://localhost:8080/alfresco/api/-default-/public/alfresco/versions/1/nodes/7c1df281-c7f9-45bc-b0a7-21ab6fd2ac0b

I get this response, notice the birthdate property, it looks correct:

{
    "entry": {
        "isFile": true,
        "createdByUser": {
            "id": "admin",
            "displayName": "Administrator"
        },
        "modifiedAt": "2020-11-02T23:08:58.158+0000",
        "nodeType": "cm:content",
        "content": {
            "mimeType": "application/pdf",
            "mimeTypeName": "Adobe PDF Document",
            "sizeInBytes": 305288,
            "encoding": "UTF-8"
        },
        "parentId": "84d277d7-47f4-4d20-87d2-e98921e55f79",
        "aspectNames": [
            "rn:renditioned",
            "dt:dateTestAspect",
            "cm:versionable",
            "cm:titled",
            "cm:auditable",
            "cm:author",
            "cm:thumbnailModification"
        ],
        "createdAt": "2020-11-02T23:08:58.158+0000",
        "isFolder": false,
        "modifiedByUser": {
            "id": "admin",
            "displayName": "Administrator"
        },
        "name": "Printer-MG3600-NetworkConfig.pdf",
        "id": "7c1df281-c7f9-45bc-b0a7-21ab6fd2ac0b",
        "properties": {
            "dt:birthDate": "1988-01-01T00:00:00.000+0000",
            "cm:versionType": "MAJOR",
            "cm:versionLabel": "1.0",
            "cm:lastThumbnailModification": [
                "doclib:1604358538907"
            ]
        }
    }
}
http://localhost:8080/alfresco/api/-default-/public/alfresco/versions/1/nodes/5a2ea7d8-57a7-453b-9be7-83dc73639dea

{ "entry": { "isFile": true, "createdByUser": { "id": "admin", "displayName": "Administrator" }, "modifiedAt": "2020-11-02T23:20:07.152+0000", "nodeType": "cm:content", "content": { "mimeType": "application/zip", "mimeTypeName": "ZIP", "sizeInBytes": 1046, "encoding": "UTF-8" }, "parentId": "84d277d7-47f4-4d20-87d2-e98921e55f79", "aspectNames": [ "rn:renditioned", "dt:dateTestAspect", "cm:versionable", "cm:titled", "cm:auditable", "cm:author", "cm:thumbnailModification" ], "createdAt": "2020-11-02T23:20:07.152+0000", "isFolder": false, "modifiedByUser": { "id": "admin", "displayName": "Administrator" }, "name": "DateTest.zip", "id": "5a2ea7d8-57a7-453b-9be7-83dc73639dea", "properties": { "dt:birthDate": "2017-12-27T00:00:00.000+0000", "cm:versionType": "MAJOR", "cm:versionLabel": "1.0", "cm:lastThumbnailModification": [ "doclib:1604359207505", "pdf:1604359209714" ] } } }


 

Repository api also resulted same results, example:

http://127.0.0.1:8080/alfresco/service/api/metadata?nodeRef=workspace://SpacesStore/5a2ea7d8-57a7-45...

{
nodeRef: "workspace://SpacesStore/5a2ea7d8-57a7-453b-9be7-83dc73639dea",
aspects: [
"{http://www.alfresco.org/model/rendition/1.0}renditioned",
"{dateTest}dateTestAspect",
"{http://www.alfresco.org/model/content/1.0}versionable",
"{http://www.alfresco.org/model/content/1.0}titled",
"{http://www.alfresco.org/model/content/1.0}auditable",
"{http://www.alfresco.org/model/system/1.0}referenceable",
"{http://www.alfresco.org/model/system/1.0}localized",
"{http://www.alfresco.org/model/content/1.0}author",
"{http://www.alfresco.org/model/content/1.0}thumbnailModification"
],
mimetype: "application/zip",
type: "{http://www.alfresco.org/model/content/1.0}content",
properties: {
{http://www.alfresco.org/model/content/1.0}created: "2020-11-02T23:20:07.152Z",
{http://www.alfresco.org/model/content/1.0}lastThumbnailModification: [
"doclib:1604359207505",
"pdf:1604359209714"
],
{dateTest}birthDate: "2017-12-27T00:00:00.000Z",
{http://www.alfresco.org/model/content/1.0}creator: "admin",
{http://www.alfresco.org/model/system/1.0}node-uuid: "8d9f5c8a-5795-4821-aa65-8c0e76499414",
{http://www.alfresco.org/model/content/1.0}name: "DateTest.zip",
{http://www.alfresco.org/model/content/1.0}content: "contentUrl=store://2020/11/2/23/20/f139b7e6-49c8-40f8-bef5-957597c9c7e2.bin|mimetype=application/zip|size=1046|encoding=UTF-8|locale=en_US_|id=290",
{http://www.alfresco.org/model/system/1.0}store-identifier: "SpacesStore",
{http://www.alfresco.org/model/content/1.0}versionLabel: "1.0",
{http://www.alfresco.org/model/content/1.0}autoVersion: true,
{http://www.alfresco.org/model/content/1.0}initialVersion: true,
{http://www.alfresco.org/model/content/1.0}versionType: "MAJOR",
{http://www.alfresco.org/model/content/1.0}autoVersionOnUpdateProps: false,
{http://www.alfresco.org/model/system/1.0}store-protocol: "workspace",
{http://www.alfresco.org/model/system/1.0}node-dbid: 936,
{http://www.alfresco.org/model/system/1.0}locale: "en_US",
{http://www.alfresco.org/model/content/1.0}modifier: "admin",
{http://www.alfresco.org/model/content/1.0}modified: "2020-11-02T23:20:07.152Z"
}
}

Results was exactly same for ACS 5.2.7 enterprise and ACS 6.2.1-A8 community in my case via V1 and repo api. I have not tried CMIS though

 

~Abhinav
(ACSCE, AWS SAA, Azure Admin)