Forum Discussion

dchou's avatar
7 years ago

Read and write custom field

We have added custom fields on application level and message level by contacting Lithium support team.

 

I don't able to find a way to access it using and API.


Is there any specific API  call to get custom fields and Is it possible to set application-level custom setting using setting editor?

 

 

 

  • dchou

    We created custom fields for users profile at backend only so we do not have any option to update it using GUI and we used the API call to update those fields like below

    <#assign update_json= restadmin("/users/id/${user.id}/profiles/name/field_1/set?value="+updated_json?url) />

    But in your case, custom fields are not for user's profile. So can you confirm what are those fields for? I assumed fields are created on the post page. 

  • dchou

    If you enabled the custom field on message create page then it should return that field in Message API. 

    select * from messages

     Similarly, we created some custom fields for users and able to get those fields in the same API. See here https://prnt.sc/iqg425

    It would not return those fields if custom fields are blank for any user. As here it returns less number of custom fields compare to another user. See here https://prnt.sc/iqg4gz

    LMK if I am getting something out of line. 

    • dchou's avatar
      dchou
      Ace

      VikasBThanks for your answer.

      Can you provide sample API call for set those fields?Because for now, I have all fields blank so not able to retrieve it.

      • VikasB's avatar
        VikasB
        Boss

        dchou

        We created custom fields for users profile at backend only so we do not have any option to update it using GUI and we used the API call to update those fields like below

        <#assign update_json= restadmin("/users/id/${user.id}/profiles/name/field_1/set?value="+updated_json?url) />

        But in your case, custom fields are not for user's profile. So can you confirm what are those fields for? I assumed fields are created on the post page.