AkamaiOPEN-edgegrid-ruby icon indicating copy to clipboard operation
AkamaiOPEN-edgegrid-ruby copied to clipboard

Missing mandatory parameter issue

Open miteshp22 opened this issue 2 years ago • 5 comments

Hello, I am attempting to call an akamai SIEM endpoint using the edgegrid ruby gem.

Below is my code but I get missing mandatory parameter and unknown as to why as the akamai documentation does not have any more required params than what I am giving it already.

require 'akamai/edgegrid'
require 'net/http'
require 'uri'

baseuri = URI('https://<>.luna.akamaiapis.net/')

http = Akamai::Edgegrid::HTTP.new(
    address=baseuri.host,
    port=baseuri.port
)

http.setup_edgegrid(
    :client_token => '<>',
    :client_secret => '<>',
    :access_token => '<>',
    :max_body => 128 * 1024
)

puts "client setup complete"

# example of simple GET request
request = Net::HTTP::Get.new URI.join(baseuri.to_s, '/siem/v1/configs/33314').to_s
response = http.request(request)
puts response.body

For obvious reasons, I have redacted the host details and authorization details.

The output of the above is:

{
"type": "https://problems.cloudsecurity.akamaiapis.net/siem/v1/missing-parameters",
"title": "Missing mandatory parameter(s) or illegal parameter(s) in the request",
"instance": "https://<>/siem/v1/configs/33314",
"detail": "Missing mandatory parameter(s) or illegal parameter(s) in the request",
"method": "GET",
"serverIp": "<>",
"clientIp": "<>",
"requestId": "4a3717f6",
"requestTime": "2024-01-03T21:04:38Z"
}

Any suggestions as to what I could be doing incorrect?

miteshp22 avatar Jan 03 '24 21:01 miteshp22

Does it work if you add in request['Accept'] = 'application/json' before making the request?

rajiv avatar Jan 03 '24 22:01 rajiv

Hi Rajiv, thanks for the quick response.

I just tried that but it did not make any difference. Still the same issue.

miteshp22 avatar Jan 04 '24 00:01 miteshp22

Hi Rajiv, I am following up -- is there another way we should be calling this API?

miteshp22 avatar Jan 09 '24 16:01 miteshp22

SIEM open api supports 2 modes offset or time-based mode - https://techdocs.akamai.com/siem-integration/recipes. To get security events from current time specify query param 'offset' as null. For example: https://<>/siem/v1/configs/33314?offset=null.

jrobins04 avatar Jan 09 '24 18:01 jrobins04

Thanks Jacob

It seems to have worked now. We were referring to the documentation https://techdocs.akamai.com/siem-integration/reference/get-configid and it does not specify offset to be required, and examples there do not use it.

Appreciate the helpful documentation above, we will refer to that one moving forward.

miteshp22 avatar Jan 09 '24 18:01 miteshp22