Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
cimt_mk
Partner - Contributor
Partner - Contributor

API TDS Semantic Service - Update dictionary entries of a semantic type

Hi all,

we need to automate updating semantic types used in Data Stewardship. Most of the time, we use semantic types of type dictionary. I'm trying to use the REST API for this.

Using endpoint /categories does work (https://tds.eu.cloud.talend.com/docs/api/swagger-ui.html?urls.primaryName=Semantic%20Service# /categories-controller/list), I get the information of the specific semantic type.

 

I tried to use the /documents endpoint to ge the list of documents / entries for a specific semantic type (https://tds.eu.cloud.talend.com/docs/api/swagger-ui.html?urls.primaryName=Semantic%20Service# /documents-controller/list_1), but I cannot get it working. I always get a 415 - Unsupported media type code back. Here is an example request I used:

 

curl --location --request GET 

'https://tds.eu.cloud.talend.com//semanticservice/documents/?category=4e508870c04b091057ad70a7' --header 'Authorization: Bearer XXX' --header 

'Cookie: XSRF-TOKEN=XXX'

 

I tried all kind of combinations.

 

In the end, I need to have an API endpoint where I can overwrite all existing entries in the dictionary of a semantic type. The job will call system A to receive a list of values and I need to send these values to a specific semantic type.

 

Thanks for your help.

Labels (2)
4 Replies
Anonymous
Not applicable

Hello @Mirco Kriesten​ ,

 

Can you try to add the content type in your API requests? Your request will then look like the following:

 

curl --location --request GET 

'https://tds.eu.cloud.talend.com//semanticservice/documents/?category=4e508870c04b091057ad70a7' --header 'Authorization: Bearer XXX' --header 

'Cookie: XSRF-TOKEN=XXX' --header 'content-type: application/json'

 

It appears that our API documentation for semantic types is missing this header when you try out an API. I will enter a bug about it.

cimt_mk
Partner - Contributor
Partner - Contributor
Author

Hi @Aurelien Fourmi​,

 

thanks, setting content-type to application/json works! Now, I tried to update the documents with this endpoint. I always get the an 410 error ("Gone" - "Your changes were discarded. Another user edited this semantic type in the meantime"). I can rule out that any modifications actually happenend in the meantime. I tried the request within the API documentation as well as with Postman. The request looks like this:

 

curl --location --request POST 'https://tds.eu.cloud.talend.com//semanticservice/documents/upload?category=5ff30a4144783e6a986f6d31&overwrite=true' \

--header 'Authorization: Bearer XXX' \

--header 'Cookie: XSRF-TOKEN=XXX' \

--form 'file=@"/C:/tmp/test.txt"

 

Thanks for your help!

cimt_mk
Partner - Contributor
Partner - Contributor
Author

Any idea? Do I need to create a ticket?

Anonymous
Not applicable

Hello @Mirco Kriesten​ 

 

Sorry for the late answer.

Have you already read this documentation: https://help.talend.com/r/39NzetoCUZMHcAnJtQuxxg/6G~ai40wIZ3PLlemIcTIPQ ?

It explains how to create or edit a semantic type. In fact, you have to create a 'sandbox' for a semantic type before updating it.

Can you try and tell me if it works for you?