API: createAdhocAPIKey
  • 1 Minute to read
  • Dark
    Light

API: createAdhocAPIKey

  • Dark
    Light

Article Summary

  • Starting June 1, 2022, SmarterU will require all API calls to POST to HTTPS. Any POST to HTTP will result in the SU:01 error (i.e., No POST data detected.).
  • If you are viewing the help in a language other than English, please change your language to English before copying and pasting any code. All API attributes and functions are in English.
  • Tags are required unless specified.
This feature is not enabled by default. If you're interested in using this feature, contact our Success Desk to have it enabled.

Description

The createAdhocAPIKey API method returns a temporary API key for a user.

The API key returned by the createAdhocAPIKey method will expire after 3 minutes.

Who Has Access

Administrators and owners have access to the createAdhocAPIKey method.

API Call XML Package

<SmarterU>
   <AccountAPI><![CDATA[]]></AccountAPI>
   <UserAPI><![CDATA[]]></UserAPI>
   <Method>createAdhocAPIKey</Method>
   <Parameters>
      <User>
         <Identifier>
            <ID><![CDATA[]]></ID>
               - OR -
            <Email><![CDATA[]]></Email>
               - OR -
            <EmployeeID><![CDATA[]]></EmployeeID>
         </Identifier>
      </User>
   </Parameters>
</SmarterU>

User Tag Group

The User tag group is a container for the user you'd like to create an API key for.

<User>
   <Identifier>
      <ID><![CDATA[]]></ID>
         - OR -
      <Email><![CDATA[]]></Email>
         - OR -
      <EmployeeID><![CDATA[]]></EmployeeID>   
   </Identifier>
</User>

The User tag contains the following.

Identifier

A container for the user that you'd like to create an API key for. The tag contains one of the following.

TagDescription
IDThe user's system-generated identifier. This tag is mutually exclusive with the Email and EmployeeID tags. This is the ID returned by the listUsers method.
EmailThe user's email address. This tag is mutually exclusive with the ID and EmployeeID tags
EmployeeIDThe user's employee ID. This tag is mutually exclusive with the ID and Email tags.

API Response XML Package

The API response XML package will always include a Result, Info, and Errors tag.

<SmarterU>
   <Result></Result>
   <Info>
      <User>
         <APIKey><![CDATA[]]></APIKey>
      </User>
   </Info>

   <Errors>
      <Error>
         <ErrorID></ErrorID>
         <ErrorMessage></ErrorMessage>
      </Error>
   </Errors>
</SmarterU>

The User tag is a container for the API key returned by the createAdhocAPIKey method and contains the following.

APIKey

The API key that was created for the user.

Example API Response XML Package

Below is an example of an API response XML package.

<SmarterU>
   <Result></Result>
   <Info>
      <User>
         <APIKey><![CDATA[*ldf^dypgnvi*nq33gml$*6xsup2*wpa8x$if2q4]]></APIKey>
      </User>
   </Info>

   <Errors>
   </Errors>
</SmarterU>

Error Codes

Error CodeMessage
CAAK:01The id provided is not valid.
CAAK:02The email address provided is not valid.
CAAK:03The employee ID provided is not valid.
CAAK:04The required permissions are not met to call the createAdhocAPIKey method.
CAAK:05The user requested does not exist.
CAAK:06This method cannot be accessed from your location.
CAAK:07The requested user cannot be retrieved via the API.

Was this article helpful?