Edit an API Key

POST /Api/Edit/Key

This process edits an existing key if it was created by your access key and it is not your own. The other parameters are optional. If GroupId is passed, it assigns the manually configured acl group ids that you have access to (see api/Read/Groups). Your primary access group that allows key creation cannot be allocated to new access keys. Secret Hmac and Today Code Required. No Caching.

Body Required


Only one of the KeyId or ApiKey are needed. If both KeyId and ApiKey are passed, they must match the same record. Other parameters can be skipped if not changing.

  • KeyId number

    Optional key id for the record to edit (ApiKey required if this is omitted)

  • ApiKey string

    Optional API Key for the record to edit (KeyId required if this is omitted)

  • The display name for this new key. This must be unique for all keys of this customer parent.

  • Email string

    The email address of the person who created this.

  • Phone string

    The phone number of the person who created this.

  • HTTP-formatted GMT/UTC date/time for the starting date for this key. This often matches the Created date.

  • EndDate string

    HTTP-formatted GMT/UTC date/time for when this key stops functioning. If the key is not active, this is the date it was disabled.

  • DayPass number

    1 if the server day password is required (changes multiple times per day). Defaults to 0 for not required.

  • Defaults to 1 for HTTPS protocol required for this key and 0 if not.

  • The number of hours that the remote computer clock can be different than the server clock. 0 ignores the x-ApiDate entirely and can be skipped. Defaults to 5 minutes.

  • The default response format that is assigned to this key. Current options are csv, json or xml and the default is json.

  • LogLevel number

    The default logging level for this key. 0=minimal, 1=medium, 2+=high. Default=0.

  • LogRaw number

    The number of days to allow raw log details to be stored and accessed. Default=0

  • MaxHits string

    The rate limiting that is assigned to this key. See Rate Limiting for details.

  • GroupId string

    The comma separated list of API groups to assign to this key. See /Api/Read/Groups endpoint for groups that can be assigned.

  • Defaults object

    The defaults for this api key.

    Hide Defaults attributes Show Defaults attributes
    • Parent number

      StrandVision Parent Number

    • Custno number

      StrandVision Customer Number

Responses

  • Created API Key successfully

    Hide response attributes Show response attributes object
    • Id number

      database id for this API Key (useful for reviewing logs)

    • Api_Key string

      the api key for this record.

    • the api secret value for this record.

    • Name string

      The descriptive name of the API Key setup by the user

    • MaxHits string

      The rate limiting that is assigned to this key. See Rate Limiting for details.

  • Bad Request - Display_Name is already defined or invalid parameter passed.

    The error returned

  • Not Found - ID Not Found or Not Authorized.

    The id was not found error message

POST /Api/Edit/Key
curl \
 -X POST https://Api.StrandVision.com/v1.0/Api/Edit/Key \
 -H "Authorization: X-apikey $ACCESS_TOKEN" \
 -H "Authorization: X-apidate $ACCESS_TOKEN" \
 -H "Authorization: X-apihmac $ACCESS_TOKEN" \
 -H "Authorization: X-apitoday $ACCESS_TOKEN" \
 -H "Content-Type: application/json" \
 -d '{"KeyId":1001,"ApiKey":"MyTestApiKey","Display_Name":"Mike Test","Email":"sales@strandvision.com","Phone":"715-235-7446","StartDate":"Wed, 10 May 2023 19:11:31 GMT","EndDate":"string","DayPass":0,"Require_Https":1,"AllowHours":1,"ResponseFormat":"json","LogLevel":1,"LogRaw":1,"MaxHits":"Burst5/50,500/hr,100k/mon","GroupId":100102,"Defaults":{"Parent":10000,"Custno":10000}}'
Request example
{
  "KeyId": 1001,
  "ApiKey": "MyTestApiKey",
  "Display_Name": "Mike Test",
  "Email": "sales@strandvision.com",
  "Phone": "715-235-7446",
  "StartDate": "Wed, 10 May 2023 19:11:31 GMT",
  "EndDate": "string",
  "DayPass": 0,
  "Require_Https": 1,
  "AllowHours": 1,
  "ResponseFormat": "json",
  "LogLevel": 1,
  "LogRaw": 1,
  "MaxHits": "Burst5/50,500/hr,100k/mon",
  "GroupId": 100102,
  "Defaults": {
    "Parent": 10000,
    "Custno": 10000
  }
}
Request examples
{
  "KeyId": 1001,
  "ApiKey": "MyTestApiKey",
  "Display_Name": "Mike Test",
  "Email": "sales@strandvision.com",
  "Phone": "715-235-7446",
  "StartDate": "Wed, 10 May 2023 19:11:31 GMT",
  "EndDate": "string",
  "DayPass": 0,
  "Require_Https": 1,
  "AllowHours": 1,
  "ResponseFormat": "json",
  "LogLevel": 1,
  "LogRaw": 1,
  "MaxHits": "Burst5/50,500/hr,100k/mon",
  "GroupId": 100102,
  "Defaults": {
    "Parent": 10000,
    "Custno": 10000
  }
}
Response examples (200)
{
  "Created": "Mon, 15 May 2023 14:34:17 GMT",
  "StartDate": "Mon, 15 May 2023 14:34:17 GMT",
  "http_host": "DV1",
  "server_name": "localhost",
  "server_addr": "127.0.0.1",
  "server_port": 443,
  "remote_addr": "127.0.0.1",
  "request_scheme": "HTTPS",
  "request_method": "POST",
  "api_acl": 2,
  "api_function": "api/Read/Limits",
  "request_url": "/v1.0/Api/Read/Limits",
  "http_user_agent": "Mozilla/5.0 (compatible; SVDSBot/1.0; +http://www.strandvision.com/bot.html)",
  "raw_request": "",
  "response_format": "JSON",
  "response_code": 200,
  "response": "{\"1Sec\":{\"Limit\":50,\"Remain\":13,\"ResetDate\":\"Mon, 15 May 2023 14:34:17 GMT\",\"TimeLeft\":\"0 Seconds\"},\"1Hour\":{\"Limit\":500,\"Remain\":174,\"ResetDate\":\"Mon, 15 May 2023 15:18:00 GMT\",\"TimeLeft\":\"43.72 Minutes\"},\"1Mon\":{\"Limit\":100000,\"Remain\":99674,\"ResetDate\":\"Thu, 15 Jun 2023 00:00:00 GMT\",\"TimeLeft\":\"1 Month\"}}",
  "seconds": 0.0308,
  "bandwidth": 874
}
Response examples (200)
{
  "Id": 1001,
  "Api_Key": "MyTestApiKey",
  "Api_Secret": "JHRF18Y4PCH4BLXRLKN0QCTXH9GKOC17",
  "Name": "Test API Key",
  "MaxHits": "Burst5/50,500/hr,100k/mon"
}
Response examples (400)
"Error: Display Name 'abc' is already defined"
Response examples (400)
Error: Display Name 'abc' is already defined
Response examples (404)
"Error: Cannot find key id 1001"
Response examples (404)
Error: Cannot find key id 1001