Rest API URL and json body for promoting a folder to dataset

Please help me with rest api url and json body for promoting a children to dataset ( example http://mydremio001:9047/api/v3/catalog/???).
Source:
{
“id”: “dremio:/my_dev/clusters/“my-project-dev01-us””,
“path”: [
“my_dev”,
“clusters”,
““my-project-dev01-us””
],
“type”: “CONTAINER”,
“containerType”: “FOLDER”
}

Just got the following error ( there is a spelling mistake in physical)
{
“errorMessage”: “Something went wrong”,
“moreInfo”: “Phyiscal Datasets can only be created by promoting other entities.”
}

Hey Ashitabh,

I’m not sure I understand when you say you’re trying to promote a folder to dataset. Would you mind expanding on what you’re trying to achieve? Thanks, Christy.

Hi Christy,
I am referring to the link (Promote a folder or file to a dataset)
https://docs.dremio.com/rest-api/catalog/endpoints.html
This rest API allows promotion of file/folder to Dataset

Hi,

Here is an example of how to promote a json file using the REST API (same exact payload would work on a folder as well:

POST http://myhost.com:9047/api/v3/catalog/{id}

{
  "entityType": "dataset",
  "path": [
    "Samples",
    "samples.dremio.com",
    "SF_incidents2016.json"
  ],
  "type": "PHYSICAL_DATASET",
  "format": {
    "type": "JSON"
  }
}

You are giving it the dataset definition you want to use (minus the ID since you are creating a new one).

Hi,
but the docs show endpoint as /api/v3/catalog
what is {id} in the end-point

Thanks for pointing that out, I missed that and edited the post to fix that. {id} is the id of the entity you are promoting. You can use the catalog endpoint to browse and find the entity and its id.

so, in your example what should be the {id}
POST http://myhost.com:9047/api/v3/catalog/{id}

I am not able to use this id in URL
“id”: “dremio:/Samples/“samples.dremio.com””,

You have to URL encode the id value - for example in Java you could use the URLEncoder class.

Thanks a lot Doron,
It is working now