# Unpublish a generic object

Unpublish a generic object by using the [UnPublish method](https://help.qlik.com/en-US/sense-developer/November2024/Subsystems/EngineJSONAPI/Content/service-genericobject-unpublish.htm).

## Example

[](https://help.qlik.com/en-US/sense-developer/Subsystems/EngineAPI/Content/Sense_EngineAPI/WorkingWithAppsAndVisualizations/PublishAppVisualizations/unpublish-generic-object.htm)

#### The goal is to create a generic object, publish the app and unpublish the generic object.

1. Create a generic object in the app.

The client sends:

```
{
  "jsonrpc": "2.0",
  "id": 4,
  "method": "CreateObject",
  "handle": 1,
  "params": [
    {
      "qInfo": {
        "qId": "lbObject",
        "qType": "ListObject"
      },
      "qListObjectDef": {
        "qStateName": "$",
        "qLibraryId": "",
        "qDef": {
          "qFieldDefs": [
            "Country"
          ],
          "qFieldLabels": [
            "Country Label"
          ],
          "qSortCriterias": [
            {
              "qSortByLoadOrder": 1
            }
          ]
        },
        "qInitialDataFetch": [
          {
            "qTop": 0,
            "qHeight": 1,
            "qLeft": 0,
            "qWidth": 1
          }
        ]
      }
    }
  ]
}
```

The engine returns:

```
{
  "jsonrpc": "2.0",
  "id": 4,
  "result": {
    "qReturn": {
      "qType": "GenericObject",
      "qHandle": 2
    },
    "qInfo": {
      "qId": "lbObject",
      "qType": "ListObject"
    }
  },
  "change": [
    1,
    2
  ]
}
```

The generic object is created and has 2 as a handle.

2. Publish the app. The identifier of the stream is specified in qStreamId. The published app should be called Golf\_Quest\_Published.

The client sends:

```
{
  "jsonrpc": "2.0",
  "id": 5,
  "method": "Publish",
  "handle": 1,
  "params": [
    "0aea44d3-222f-43ad-acf3-e99a294ec405",
    "Golf_Quest_Published"
  ]
}
```

The engine returns:

```
{
  "jsonrpc": "2.0",
  "id": 5,
  "result": {}
}
```

The app is published.

3. Check that the generic object is published. The handle of the request is 2 because the generic object has two as a handle.

The client sends:

```
{
  "jsonrpc": "2.0",
  "id": 6,
  "method": "GetLayout",
  "handle": 2,
  "params": []
}
```

The engine returns:

{ "jsonrpc": "2.0", "id": 6, "result": { "qLayout": { "qInfo": { "qId": "lbObject", "qType": "ListObject" }, "qMeta": { "title": "", "privileges": [ "create", "read", "update", "delete", "publish", "changeowner" ], "modifiedDate": "2014-08-22T12:03:19.401Z", "published": true, "publishTime": "2014-08-22T12:03:19.389Z", "approved": true, "owner": { "userId": "platform\_tester", "userDirectory": "QT", "name": "platform\_tester", "privileges": null, "id": "255a9338-b038-479b-9543-1c2c9045cc1f" }, "qSize": -1 }, "qSelectionInfo": {}, "qListObject": { "qStateName": "$", "qSize": { "qcx": 1, "qcy": 22 }, "qDimensionInfo": { "qFallbackTitle": "Country Label", "qApprMaxGlyphCount": 14, "qCardinal": 22, "qSortIndicator": "A", "qGroupFallbackTitles": [ "Country Label" ], "qGroupPos": 0, "qStateCounts": { "qLocked": 0, "qSelected": 0, "qOption": 22, "qDeselected": 0, "qAlternative": 0, "qExcluded": 0, "qSelectedExcluded": 0, "qLockedExcluded": 0 }, "qTags": [ "$ascii", "$text" ], "qDimensionType": "D", "qGrouping": "N", "qNumFormat": { "qType": "R", "qnDec": 14, "qUseThou": 1, "qFmt": "##############", "qDec": ".", "qThou": "," }, "qIsAutoFormat": true, "qGroupFieldDefs": [ "Country" ] }, "qExpressions": [], "qDataPages": [ { "qMatrix": [ [ { "qText": "United States", "qNum": "NaN", "qElemNumber": 0, "qState": "O" } ] ], "qTails": [], "qArea": { "qLeft": 0, "qTop": 0, "qWidth": 1, "qHeight": 1 } } ] } } } }

The generic object is published. Result: result/qLayout/qMeta/published is set to true.

3. Unpublish the generic object. The handle of the request is 2 because the generic object has two as a handle.

The client sends:

{ "jsonrpc": "2.0", "id": 7, "method": "UnPublish", "handle": 2, "params": [] }

The engine returns:

{ "jsonrpc": "2.0", "id": 7, "result": {}, "change": [ 2 ] }

The object is unpublished.

4. Check that the generic object is unpublished.

The client sends:

{ "jsonrpc": "2.0", "id": 8, "method": "GetLayout", "handle": 2, "params": [] }

The engine returns:

{ "jsonrpc": "2.0", "id": 8, "result": { "qLayout": { "qInfo": { "qId": "lbObject", "qType": "ListObject" }, "qMeta": { "title": "", "privileges": [ "create", "read", "update", "delete", "publish", "changeowner" ], "modifiedDate": "2014-08-22T12:03:21.608Z", "published": false, "publishTime": "1753-01-01T00:00:00Z", "approved": false, "owner": { "userId": "platform\_tester", "userDirectory": "QT", "name": "platform\_tester", "privileges": null, "id": "255a9338-b038-479b-9543-1c2c9045cc1f" }, "qSize": -1 }, "qSelectionInfo": {}, "qListObject": { "qStateName": "$", "qSize": { "qcx": 1, "qcy": 22 }, "qDimensionInfo": { "qFallbackTitle": "Country Label", "qApprMaxGlyphCount": 14, "qCardinal": 22, "qSortIndicator": "A", "qGroupFallbackTitles": [ "Country Label" ], "qGroupPos": 0, "qStateCounts": { "qLocked": 0, "qSelected": 0, "qOption": 22, "qDeselected": 0, "qAlternative": 0, "qExcluded": 0, "qSelectedExcluded": 0, "qLockedExcluded": 0 }, "qTags": [ "$ascii", "$text" ], "qDimensionType": "D", "qGrouping": "N", "qNumFormat": { "qType": "R", "qnDec": 14, "qUseThou": 1, "qFmt": "##############", "qDec": ".", "qThou": "," }, "qIsAutoFormat": true, "qGroupFieldDefs": [ "Country" ] }, "qExpressions": [], "qDataPages": [ { "qMatrix": [ [ { "qText": "United States", "qNum": "NaN", "qElemNumber": 0, "qState": "O" } ] ], "qTails": [], "qArea": { "qLeft": 0, "qTop": 0, "qWidth": 1, "qHeight": 1 } } ] } } } }

The object is unpublished. Result: result/qLayout/qMeta/published is set to false.