We’ve developed some resources to help you work effectively from home during COVID-19 Click to learn more

REST API - Preference Agent - Strange behaviour


I am using the Preference Agent as described here: https://community.superoffice.com/documentation/sdk/SO.NetServer.Web.Services/html/Reference-WebAPI-Agents-Preference_Agent-Preference_Agent.htm

I have created two preferences in my development database, as below:


When using GetPreference and specifying the ID, I get a response I would expect:


However, when I use GetPreferences, I get the preferences I expect, but the ID and Level fields are not populated:


When I try to get all the preferences for the Section using GetAllFromSection, I get an empty array:

And this is similat to calling GetFromSectionAndKey:

I tried using the Preference REST enpoints as described here: https://community.superoffice.com/documentation/sdk/SO.NetServer.Web.Services/html/Reference-WebAPI-REST-Preference-Preference.htm

With similar results:

Calling with the Section and Key results in the correct response:


But when calling with just the Section, an empty array:


Please can you advise what I am doing wrong, and how to use these calls correctly?







RE: REST API - Preference Agent - Strange behaviour

HI Rich,

The GetPreferences method documentation is wrong. It unfortuntely only returns the fields you see.

Both GetAllFromSection and GetFromSectionAndKey do not return any (PreferenceDescription) because you do not have a section added in the PrefDesc table. This is likely why you are not seeing anything in GET requests as well.

I had a discussion about this topic awhile back and got things sorted out. I hope this will help you too.

Best regards!

Von: Tony Yates 30. Jan 2020

RE: REST API - Preference Agent - Strange behaviour

Tony, Many Thanks!


Von: Rich Hacker 30. Jan 2020