Loading...

PUT   https://api.3seventy.com/api/v2.1/account/{accountId}/api-key/{keyId}

Description

Change an Api Key secret.

Path Parameters

keyId integer An Api Key to update. required
accountId integer The ID of the account to update. required

Response Properties application/json

AccountId integer An account this api key has access to.
Key string A key. Used as a login name.
Label string User-defined identificator
LastActivity string A time of last login.
Secret string A secret. Used as a login password.
Type string A key type mapping.
TypeId number Type of a key.
UserName string A user this key is owned by if any. For master keys only.
ValidTo string A datetime this key is valid to. For temporary keys only.
{
     "Id": 1961,
     "Label": "Master1",
     "Key": "022ff62714384e3693e709da772f8470",
     "TypeId": 1,
     "Type": 1,
     "ValidTo":  "2019-06-21T13:43:15",
     "LastActivity": "2018-06-21T13:43:15",
     "AccountId": 43510,
     "UserName": "Integraton_User_1"
   }

C#


using System;
using System.Collections.Generic;
using System.Linq;
using ThreeSeventy.Vector.Client;
using ThreeSeventy.Vector.Client.Models;

public class Program
{

private static void Main(string[] args)
{

const int accountId = XXXX;

const int keyId = XXX;

var context = new T70Context();

var apiKeyRepo = context.Repository<ApiKey>(new { AccountId = accountId });

var item = apiKeyRepo.Get(keyId);

item.ValidTo = DateTime.Now.AddDays(10);

apiKeyRepo.Update(item);

}

}