Unable to edit the sources with REST API

Hi,

I am a newbie to dremio. I was trying to work with the rest api for sources.I was able to post,get the sources but i was unable to edit the source. Can you please tell me where am i going wrong?

I used the url for post : http://192.168.0.78:9047/api/v3/source

My input was:
{
“name”: “sample source”,
“description”: “sample source”,
“type”: “MONGO”,
“config”:{
“hostList”: [{“hostname”: “192.168.0.78”, “port”: “27017”}],
“authenticationType”: “ANONYMOUS”
}
}

My output was:
{
“_type”: “source”,
“config”: {
“password”: “DREMIO_EXISTING_VALUE”,
“hostList”: [
{
“hostname”: “192.168.0.78”,
“port”: 27017
}
],
“useSsl”: false,
“authenticationType”: “ANONYMOUS”,
“authenticationTimeoutMillis”: 2000,
“secondaryReadsOnly”: false,
“subpartitionSize”: 0
},
“state”: {
“status”: “good”,
“messages”: [
{
“level”: “INFO”,
“message”: “MongoDB version 3.2.21.”
}
]
},
“id”: “bed30c08-ab6a-42a4-aee3-e038eab6b4ac”,
“tag”: “0”,
“type”: “MONGO”,
“name”: “sample source”,
“description”: “sample source”,
“createdAt”: “2018-09-07T07:24:19.243Z”,
“metadataPolicy”: {
“authTTLMs”: 86400000,
“namesRefreshMs”: 3600000,
“datasetRefreshAfterMs”: 3600000,
“datasetExpireAfterMs”: 10800000,
“datasetUpdateMode”: “PREFETCH_QUERIED”
},
“accelerationGracePeriodMs”: 0,
“accelerationRefreshPeriodMs”: 0,
“accelerationNeverExpire”: false,
“accelerationNeverRefresh”: false
}

Now, i want to edit the source:
I used the url : http://192.168.0.78:9047/api/v3/source/bed30c08-ab6a-42a4-aee3-e038eab6b4ac (PUT) (The id is the id created by dremio for the above source)

My header had content-type and authorization.
My body was:
{
“name”:“sample source”,
“description”:“sample source edited”, #i have edited the source description
“config”:{
“hostList”:[{“hostname”:“192.168.0.78”,“port”:“27017”}]},
“type”:“MONGO”
}

Im getting the below error:
{
“errorMessage”: “Something went wrong”,
“moreInfo”: “Source id is immutable.”
}

I tried with catalog api also, i could not edit the sources. Can you please help me?

Your earliest reply will help me a lot.Thanks in advance

Hi,

You need to reflect the payload from the GET call with your changes added when doing a PUT - the API needs the id and the tag in the body for example. The API does not support partial updates currently.

We are working on improving the docs with examples to make that clearer.