How to update Secrets value

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • zkuun8
    Junior Member
    • Dec 2024
    • 25

    How to update Secrets value

    At the moment, I store Token for API into a secrets value.
    I would like to be able to update an existing Secrets Value in order to refresh the new token.
    Code:
    record\update\"AppSecret", "xxxxxxxxxxxxxxxxx", "value", "fklsdklfdsklf")
    , when I check the UI, the value is empty.
    another question, is how to Create a new Scecrets record, and get the ID.

    thanks,
  • lazovic
    Super Moderator
    • Jan 2022
    • 827

    #2
    Hi zkuun8,

    Creating an App Secret:
    Code:
    $newAppSecret = record\create('AppSecret',
                                  'name', 'New App Secret',
                                  'value', 'new_app_secret',
                                  'description', 'Desc.');
    Getting an App Secret ID by name:
    Code:
    $id = record\findOne('AppSecret', 'createdAt', 'desc', 'name', 'New App Secret');
    Getting an App Secret value by ID:
    Code:
    $value = record\attribute('AppSecret', $id, 'value');
    Updating an App Secret value:
    Code:
    $updateValue = record\update('AppSecret', $id, 'value', 'new_app_secret_1');

    Comment

    Working...