For a deeper look into our DataScope Select REST API, look into:

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials

question

Upvotes
Accepted
43 2 6 9

DSS REST API python sample of user preferences change

Does any python or postman code available to change DSS user preferences?

dss-rest-apidatascope-selectdss
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvote
Accepted
9.6k 10 7 7

Hello @kazuhisa.matsuda

User preferences change example can be found in C# Example Application. Apart from C# source code, the application also shows HTTP requests and responses in HTTP tab.

The application demonstrates how to change PartialEmbargoedReportsEnabled user preference in Update User Preferences under User Examples section.

The first step is to get all user preferences. My PartialEmbargoedReportsEnabled user preference is true like example below:

The next step is to update the preferences using PUT method. The body is all user preferences got from the first step with the changed preference. In this example, it sets PartialEmbargoedReportsEnabled to be false. Then, you should receive the successful response, 204 HTTP response code.

Hope this help.


icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
43 2 6 9

I could get user preference.getpreference.jpg but got error to put(update) the preference. setpreference.jpg.. What am I missing??


getpreference.jpg (123.4 KiB)
setpreference.jpg (98.1 KiB)
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
11.3k 25 9 14

Hi @kazuhisa.matsuda,

Can you try the json parameter in requests.put() method instead of data parameter? For more information, please see this guide.

requests.put(Url, json=body, headers=requestHeaders)

Normally, the reason of status 400 (bad request) will be provided in the response body. You can also add the following code to get more information from response body.

res = requests.put(....) 
print(res.text)

If the issue still persist, please share the body of status 400.

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
43 2 6 9

works! thank you..

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.