Qlik Community

Qlik Sense Integration, Extensions, & APIs

Discussion board where members can learn more about Integration, Extensions and API’s for Qlik Sense.

Announcements
Qlik® Product Spotlight: Discover what’s possible. Get more from our products.
See for yourself. Register today.
Not applicable

Update object with QRS API

Hi everyone,

I am working with API to build deployment and managment tools for Qlik Sense.

I can create any kind of object, publish, clone apps, create dimensions, tags, security rules etc

But I am encountering an issue with all updates (Qlik Sense 2.1.1)

I tried two ways, with a tag exemple :

-1)  With the update method :

https://help.qlik.com/en-US/sense-developer/2.1/Subsystems/RepositoryServiceAPI/Content/RepositorySe...

I am receiving a 409 Conflict error code by sending objects with same structure as received.

Here is the codes samples :

Qlik Sense API Update 1.png

And my result :

https://FNTVAQSEDEV0847.france.rexel:4242/qrs/tag?Xrfkey=0123456789abcdef&

[

{"id":"4de7822b-cadf-462b-86c2-f8f06c5d21f1","name":"MDM","privileges":null},

{"id":"789a093d-b32c-4c5e-87d9-332a2ed835a0","name":"TestAPI","privileges":null}

]

Update tag ...

{

   "Name": "TestAPIUpdated",

   "ID": "789a093d-b32c-4c5e-87d9-332a2ed835a0",

   "ModifiedDate": "/Date(1382706746631+0200)/"

}

https://FNTVAQSEDEV0847.france.rexel:4242/qrs/tag/789a093d-b32c-4c5e-87d9-332a2ed835a0?Xrfkey=012345...

Le serveur distant a retourné une erreur : (409) Conflit.

2) With Update Selection method

Help is not helpfull :

https://help.qlik.com/en-US/sense-developer/2.1/Subsystems/RepositoryServiceAPI/Content/RepositorySe...

Thanks to this post I could have a concrete sample :

Using QRS to add a user to a stream

Here is the request and result (no fail, ut nothing has change) :

1) Send selection

https://FNTVAQSEDEV0847.france.rexel:4242/qrs/selection/tag?Xrfkey=0123456789abcdef&filter=id eq 789a093d-b32c-4c5e-87d9-332a2ed835a0

{"items":[{"objectID":"789a093d-b32c-4c5e-87d9-332a2ed835a0","type":"Tag","objec

tName":"TestAPI","data":null}],"id":null}

Result :

{"id":"6b5f0fbd-7415-4349-b07c-d02f0fef8833","createdDate":"1753-01-01T00:00:00.000Z","modifiedDate":"1753-01-01T00:00:00.000Z","modifiedByUserName":"INTERNAL\\

sa_repository","items":[{"id":"29783b81-bcd6-436b-a1b8-90eb683b739a","createdDate":"1753-01-01T00:00:00.000Z","modifiedDate":"1753-01-01T00:00:00.000Z","modifiedByUserName":"INTERNAL\\sa_repository","type":"Tag","objectID":"789a093d-b32c-4c5e-87d9-332a2ed835a0","objectName":"","schemaPath":"Selection.Item"}],"privilege

s":null,"schemaPath":"Selection"}

2) Send update

https://FNTVAQSEDEV0847.france.rexel:4242/qrs/selection/6b5f0fbd-7415-4349-b07c-d02f0fef8833/app/syn... eq 789a093d-b32c-4c5e-87d9-332a2ed835a0

{

     "properties": [

          {

               "name": "name",

               "value": "d422f442-7a57-4613-86d2-64a6b31e40b7",

               "valueIsModified":true,

               "schemaPath": "SyntheticProperty"

          }

     ],

     "type":"tag"

}

Response : blank line => should be ok

Result : Unfortunatly, nothing changed, and I can't find effective way to update object property.

Thanks by advance for any help.

Ghislain Ferréol

Tags (2)
1 Solution

Accepted Solutions
Not applicable

Re: Update object with QRS API

Ghislain,

You might want to try the following:

- before update: perform a full GET (i.e. with "/full" qualifier in URL) for the tag you are updating

- use the modifiedDate value from the full GET response in your PUT call

This solved this problem for use. Using any other modifiedDate in the PUT call gave us 409 error.

5 Replies
Not applicable

Re: Update object with QRS API

I've been getting these conflict errors as well with random QRS update calls. I'd be interested in hearing what is causing them and what could I do differently to avoid them.

Cheers,

Toni

Not applicable

Re: Update object with QRS API

Ghislain,

You might want to try the following:

- before update: perform a full GET (i.e. with "/full" qualifier in URL) for the tag you are updating

- use the modifiedDate value from the full GET response in your PUT call

This solved this problem for use. Using any other modifiedDate in the PUT call gave us 409 error.

Not applicable

Re: Update object with QRS API

Toni,

Thank you so much, it works perfectly well now.

I just had to change 2 lines with your recommandation :

Qlik Sense API Update 2.png

Date value return by Full GET is actually in a different format than defined on the online help : 2015-12-23T14:33:16.361Z, easier to read.

I also tried to use DateTime.Now.ToString("s") as date value and it also works fine.

I'll try with other objects types.

Thanks, Ghislain

Not applicable

Re: Update object with QRS API

De rien

Nice to hear you got it working. I'm not sure if this is a bug in Qlik because QRS should basically be able to set the modified timestamp by itself when updating an entity.

cesaraccardi
Valued Contributor

Re: Update object with QRS API

Hello,

I am testing QRS API and am facing a similar issue. I would appreciate if you can give any insights:

QRS API - updating users custom properties

Thanks,

Cesar

Community Browser