Updating Dataset Field Descriptions via API and Troubleshooting

Original Slack Thread

Hi, I wonder if someone could give me a hint as to how to update dataset fields descriptions via API.

I’ve run into a problem trying to update a dataset field description using updateDescription. I realize that it’s incubating, but the docs mention that it <Mutations | DataHub only supports Dataset Schema Fields, Containers>. So, I thought it should work, but looks like I was wrong. My mutation (I used GraphQL) looks like this:

  updateDescription(
    input: {
      description: "My description",
      resourceUrn: "urn:this:is:(urn:some:urn:),fieldname)"
    }
  )
}```
The response I get is:

“message”: “An unknown error occurred.”```
and

        "code": 500,
        "type": "SERVER_ERROR",
        "classification": "DataFetchingException"
      }```
What am I doing wrong? And is there a better way to add/change field descriptions programmatically?

Oh. Just figured it out myself. You know, there’s this magic: you spend hours trying to solve a problem, then you give in and ask a question, and lo and behold, it dawns on you.

Now, just in case someone else runs into this:

1/ As to my query above, all fields should be filled, like so:

  updateDescription(
    input: {
      description: "My description",
      resourceUrn: "My dataset URN, not that of the field!!!",
      subResource: "field_name, that is the ending of the field URN",
      subResourceType: DATASET_FIELD
    }
  )
}```
Now it works.

2/ In fact, the whole thing is working on GraphQL API, so basically, we simply use all the same queries in our scripts. So as soon as we need a reference, we can open DevTools &gt; Network and check out the payload of the necessary request.

Thanks for sharing, Anna!