Skip to main content

POST User ApiKey

Overview


The following table contains important information about the POST method in regards to adding an API Key to a user.

POST User ApiKey
MethodPOST
URL or Endpoint/api/projects/projectId/users/apikey
HeadersAuthorization
ParametersprojectId
BodylistProjectsId, roleId, userApiKey, apiName, hasExpireTime, startDateTime, expireDateTime

The description of the URL parameter is as follows:

projectId URL Parameter
URL Parameter NameprojectId
MandatoryYes
Typestring
DescriptionUnique Id of the project.

Request Body

{
"listProjectsId": ["agmipnxd"],
"roleId": 57,
"userApiKey": {
"apiName": "API Key Test",
"hasExpireTime": true,
"startDateTime": "2021-09-10T10:48:05.849Z",
"expireDateTime": "2021-09-11T10:48:05.849Z"
}
}

Information about the fields that appear in the request body are displayed in the table below.

Field NameTypeDescription
listProjectsIdarray[string]Returns the ids of the projects as an array of strings.
roleIdinteger($int32)The id of the role.
userApiKeyObjectReturns the user ApiKey object.
apiNamestringThe name of the ApiKey.
hasExpireTimeboolIndicates whether the ApiKey has an expire time.
startDateTimeDateThe start date of the ApiKey.
expireDateTimeDateThe expiring date of the ApiKey.

Response

{
"success": true,
"errors": [],
"messages": ["Api Key to user added successfully!"],
"result": {
"apiKey": "C869FEFF12434F5C9F06567A59D3E31D096FE417C63E45099F36C40985FA068B"
},
"resultInfo": null,
"statusCode": 200
}

Information about the fields that appear when you receive the response are displayed in the table below.

Field NameTypeDescription
successboolIf the response is successful it will return true. Otherwise will return false.
errorsarray[]Indicates if there was an error.
messagesarray[]Returns the response message from back-end.
resultarray[Object]Returns the response object.
apiKeystringThe ApiKey.
resultInfostringReturns extra information about the result.
statusCodeinteger($int32)Returns the HTTP Status Code.

If the action is successful, the service sends back an HTTP 200 or 201 response.

Errors

For information about the errors that are common to all actions, see Common Errors:

  • HTTP Status Code 400: Bad Request

  • HTTP Status Code 401: Unauthorized

  • HTTP Status Code 403: Forbidden

  • HTTP Status Code 404: Result Not Found

  • HTTP Status Code 500: Internal Server Error

  • HTTP Status Code 503: Backend Fetch Failed