Qlik Community

Qlik Sense Integration, Extensions, & APIs

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

brantley_hobbs
New Contributor III

How do I approve an app object via selection API?

Hi there!

I'm trying to programmatically (via powershell and the QRS API) approve app objects, but I keep getting "409 conflict" errors.

From my own past experience, this has been an indicator that I'm missing the modifiedDate on whatever object I'm altering, but in this case, I am for-sure supplying it.

Using this post as a reference, I'm doing the following:

  • Do a POST on "/qrs/selection" with the following body

{

  "items": [

    {

      "type": "App.Object",

      "objectID": "0fd0fdad-d35d-4317-9219-0924541946a1"

    }

  ]

}

  • Get the following selection response

{

  "id": "767d3de9-4b24-41f4-a9ed-c11a1d0097bb",

  "createdDate": "1753-01-01T00:00:00Z",

  "modifiedDate": "1753-01-01T00:00:00Z",

  "modifiedByUserName": "INTERNAL\\sa_repository",

  "items": [

    {

      "id": "ab4c000e-d528-42ab-812b-3475f5de4e09",

      "createdDate": "1753-01-01T00:00:00Z",

      "modifiedDate": "1753-01-01T00:00:00Z",

      "modifiedByUserName": "INTERNAL\\sa_repository",

      "type": "App.Object",

      "objectID": "0fd0fdad-d35d-4317-9219-0924541946a1",

      "objectName": "",

      "schemaPath": "Selection.Item"

    }

  ],

  "privileges": null,

  "schemaPath": "Selection"

}

  • Do a PUT on  "/qrs/selection/767d3de9-4b24-41f4-a9ed-c11a1d0097bb/app/object/synthetic" with the following body:

{

  "type": "App.Object",

  "properties": [

    {

      "modifiedDate": "2018-05-07T18:03:35.598Z",  <- I've tried several values here

      "value": "True",

      "name": "approved",

      "valueIsDifferent": "False",

      "valueIsModified": "True"

    }

  ]

}

  • Receive the following error:

"Response status code does not indicate success: 409 (Conflict)."


I have tried putting the modifiedDate both inside and outside the "properties" structure, and have tried the modifiedDate on both the selection object, and the app object itself.  I have also taken the step of doing a full get on the app object itself just prior to my PUT call to ensure that I have a correct modifiedDate.


The code used to construct URLs, set up headers, etc., is all reused from a library that works perfectly well with every other call (including publish calls, exports, etc.)  It seems that I just do not have the right formulation of the body for the PUT call.


Any insights?

1 Solution

Accepted Solutions
brantley_hobbs
New Contributor III

Re: How do I approve an app object via selection API?

Ahh!  The answer was right in front of me in the reference page I linked to, but I chalked it up as a typo.  Turns out it's a (IMHO) inconsistent API.

It's "latestModifiedDate", not "modifiedDate", and you generate a timestamp from the current time to put in there.

For future generations, here's what a properly formatted PUT body looks like:

{

  "type": "App.Object",

  "latestModifiedDate": "2018-05-07T18:03:35.598Z",

  "properties": [

    {

      "value": "True",

      "name": "approved",

      "valueIsDifferent": "False",

      "valueIsModified": "True"

    }

  ]

}

1 Reply
brantley_hobbs
New Contributor III

Re: How do I approve an app object via selection API?

Ahh!  The answer was right in front of me in the reference page I linked to, but I chalked it up as a typo.  Turns out it's a (IMHO) inconsistent API.

It's "latestModifiedDate", not "modifiedDate", and you generate a timestamp from the current time to put in there.

For future generations, here's what a properly formatted PUT body looks like:

{

  "type": "App.Object",

  "latestModifiedDate": "2018-05-07T18:03:35.598Z",

  "properties": [

    {

      "value": "True",

      "name": "approved",

      "valueIsDifferent": "False",

      "valueIsModified": "True"

    }

  ]

}

Community Browser