Des anyone know where you put the API key for the for the API you are trying to connect to? I don't see a place for it when creating a REST instance in K2 Cloud Management and it doesn't look like it goes in the swagger file. I watched a video on how to configure REST api for K2 cloud. It talked about using an API key but didn't say where it goes.
Hey Maurice,
The API Key is used in the Service Instance Configuration Settings for the Default HTTP Request Header value. API Keys, Bearer tokens and any other authorization requirements for the service need to be passed through this header.
The documentation for K2 Cloud Rest mentions this breifly but does not explicitly say 'API Key'.
"Used to supply default HTTP headers that should be added onto every HTTP request. This key is a name/value pair that is serialized using the HttpHeader system type as shown below in The HttpHeader Type section. An example of an HttpHeader value might be an additional authentication name/value pair required by the service."
"The HttpHeader system type is a special type of service object that is used to serialize or deserialize name/value pairs for the Service Instance or for individual methods. To use this type you must generate a SmartObject from the service object and then call a method on the SmartObject. When specifying this header you execute the Serialize method on the HttpHeader object (which you can find in the System Types folder in the SmartObject) and use the serialized value. If you need more than one HttpHeader you serialize each name/value pair and then use the Serialize Add Item to Array method for each name/value pair that needs to be passed to the endpoint."
I was able to find another community article that may be able to assist you with setting up the API Key.
Another helpful link:
https://community.k2.com/t5/General/How-to-pass-Header-into-REST-Service-SMO/m-p/109096#M4717
I hope this helps point you in the right direction.
Thanks,
K2Z
Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.