Anonymous_User Absent Member.
Absent Member.
454 views

Sentinel 7.0.1 REST API Event List


I try to use the 'REST API (Beta)'
(http://www.novell.com/developer/plugin-sdk/ref/restapi/7.0/) to get
events and correlated events.

I can get a authentifiion token and some data, but I have some problems
to get the data I want.

This is a part of my script :


Code:
--------------------

BASIC_AUTH_VALUE=`echo -n "$USER_NAME_PARAM:$PASSWORD_PARAM" | base64`
BASIC_AUTH_HDR="Authorization : Basic $BASIC_AUTH_VALUE"

AUTH_RESPONSE=`curl -s -k -XPOST -H "$BASIC_AUTH_HDR" -H "Accept: application/json" "$PROTOCOL_PARAM://$HOST_NAME_PARAM:$PORT_PARAM/SentinelAuthServices/auth/tokens"`

SAML_AUTH_TOKEN=`echo "${AUTH_RESPONSE}" | sed -rn 's/\{"Token":"([^"]+)".+/\1/p'`

SAML_AUTH_HDR="Authorization : X-SAML $SAML_AUTH_TOKEN"

curl -k -XPOST -H "$SAML_AUTH_HDR" -H "Accept: application/json" "$PROTOCOL_PARAM://$HOST_NAME_PARAM:$PORT_PARAM/SentinelRESTServices/objects/event"

--------------------


And this is the result :

Code:
--------------------

{"Fault":{"Code":{"Value":"Sender","Subcode":{"Value":"NoAccess"}},"Reason":{"Text":"Insufficient permission for user 'admin'."}}}

--------------------


I always test with user admin, this user have is the default
administrator. I try with an other user with database right or others
right but nothing works.

Please can you tell me where is my mistake ? Is it the user permissions,
my request or it's not possible to get data of events using this API ?


--
chris54
------------------------------------------------------------------------
chris54's Profile: https://forums.netiq.com/member.php?userid=1915
View this thread: https://forums.netiq.com/showthread.php?t=44981

0 Likes
3 Replies
Anonymous_User Absent Member.
Absent Member.

Re: Sentinel 7.0.1 REST API Event List

Hi Chris,

>>> On 18.10.2012 at 10:44, chris54<chris54@no-mx.forums.netiq.com> wrote:


> I try to use the 'REST API (Beta)'
> (http://www.novell.com/developer/plugin‑sdk/ref/restapi/7.0/) to get
> events and correlated events.
>
> I can get a authentifiion token and some data, but I have some problems
> to get the data I want.


You're using the http POST method in your request on /objects/event. That
would create a new event in Sentinel (but is not implemented in 7.0, thus
the misleading error message).

To get events, use GET.

You should look at the API doc in your local 7.0.2 system. It has been
improved from 7.0.1

Norbert

>
> This is a part of my script :
>
>
> Code:
> ‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑
>
> BASIC_AUTH_VALUE=`echo ‑n "$USER_NAME_PARAM:$PASSWORD_PARAM" |

base64`
> BASIC_AUTH_HDR="Authorization : Basic $BASIC_AUTH_VALUE"
>
> AUTH_RESPONSE=`curl ‑s ‑k ‑XPOST ‑H "$BASIC_AUTH_HDR" ‑H

"Accept:
> application/json"
> "$PROTOCOL_PARAM://$HOST_NAME_PARAM:$PORT_PARAM/SentinelAuthServices/auth
> /tokens"`
>
> SAML_AUTH_TOKEN=`echo "${AUTH_RESPONSE}" | sed ‑rn
> 's/\{"Token":"([^"]+)".+/\1/p'`
>
> SAML_AUTH_HDR="Authorization : X‑SAML $SAML_AUTH_TOKEN"
>
> curl ‑k ‑XPOST ‑H "$SAML_AUTH_HDR" ‑H "Accept: application/json"


> "$PROTOCOL_PARAM://$HOST_NAME_PARAM:$PORT_PARAM/SentinelRESTServices/obje
> cts/event"
>
> ‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑
>
>
> And this is the result :
>
> Code:
> ‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑
>
>
> {"Fault":{"Code":{"Value":"Sender","Subcode":{"Value":"NoAccess"}},"Rea
> son":{"Text":"Insufficient permission for user 'admin'."}}}
>
> ‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑
>
>
> I always test with user admin, this user have is the default
> administrator. I try with an other user with database right or others
> right but nothing works.
>
> Please can you tell me where is my mistake ? Is it the user permissions,
> my request or it's not possible to get data of events using this API ?


0 Likes
Anonymous_User Absent Member.
Absent Member.

Re: Sentinel 7.0.1 REST API Event List


Norbert Klasen;216304 Wrote:
> Hi Chris,
>
> >>> On 18.10.2012 at 10:44, chris54<chris54@no-mx.forums.netiq.com>

> wrote:
>
> > I try to use the 'REST API (Beta)'
> > (http://www.novell.com/developer/plugin‑sdk/ref/restapi/7.0/) to

> get
> > events and correlated events.
> >
> > I can get a authentifiion token and some data, but I have some

> problems
> > to get the data I want.

>
> You're using the http POST method in your request on /objects/event.
> That
> would create a new event in Sentinel (but is not implemented in 7.0,
> thus
> the misleading error message).
>
> To get events, use GET.
>
> You should look at the API doc in your local 7.0.2 system. It has been
> improved from 7.0.1
>


Norbert thank for your answer.

Effectively, I look at the wrong API version.

But, I already try to use GET and nothing is return.
Maybe I don't use the good method to get events or correlated events ?

Here my new test line :

Code:
--------------------

curl -k -XGET -H "$SAML_AUTH_HDR" -H "Accept: application/json" "$PROTOCOL_PARAM://$HOST_NAME_PARAM:$PORT_PARAM/SentinelRESTServices/objects/event"

or

curl -k -XGET -H "$SAML_AUTH_HDR" -H "Accept: application/json" "$PROTOCOL_PARAM://$HOST_NAME_PARAM:$PORT_PARAM/SentinelRESTServices/objects/event?page=2&pagesize=1"

--------------------


--
chris54
------------------------------------------------------------------------
chris54's Profile: https://forums.netiq.com/member.php?userid=1915
View this thread: https://forums.netiq.com/showthread.php?t=44981

0 Likes
Anonymous_User Absent Member.
Absent Member.

Re: Sentinel 7.0.1 REST API Event List

Hi Chris,
no idea why that request doesn't return any data. You might want to follow
the howto:
https://your-sentinel-server:8443/SentinelRESTServices/apidoc/en/howtos/inde
x.html#Searching_Events

Norbert

P.S.: The plugin-sdk forum might provide a better audience for REST API
question?


>>> On 18.10.2012 at 16:24, chris54<chris54@no-mx.forums.netiq.com> wrote:


> Norbert Klasen;216304 Wrote:
>> Hi Chris,
>>
>> >>> On 18.10.2012 at 10:44, chris54<chris54@no‑mx.forums.netiq.com>

>> wrote:
>>
>> > I try to use the 'REST API (Beta)'
>> > (http://www.novell.com/developer/plugin‑sdk/ref/restapi/7.0/) to

>> get
>> > events and correlated events.
>> >
>> > I can get a authentifiion token and some data, but I have some

>> problems
>> > to get the data I want.

>>
>> You're using the http POST method in your request on /objects/event.
>> That
>> would create a new event in Sentinel (but is not implemented in 7.0,
>> thus
>> the misleading error message).
>>
>> To get events, use GET.
>>
>> You should look at the API doc in your local 7.0.2 system. It has been
>> improved from 7.0.1
>>

>
> Norbert thank for your answer.
>
> Effectively, I look at the wrong API version.
>
> But, I already try to use GET and nothing is return.
> Maybe I don't use the good method to get events or correlated events ?
>
> Here my new test line :
>
> Code:
> ‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑
>
> curl ‑k ‑XGET ‑H "$SAML_AUTH_HDR" ‑H "Accept: application/json"


> "$PROTOCOL_PARAM://$HOST_NAME_PARAM:$PORT_PARAM/SentinelRESTServices/obje
> cts/event"
>
> or
>
> curl ‑k ‑XGET ‑H "$SAML_AUTH_HDR" ‑H "Accept: application/json"


> "$PROTOCOL_PARAM://$HOST_NAME_PARAM:$PORT_PARAM/SentinelRESTServices/obje
> cts/event?page=2&pagesize=1"
>
> ‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑


0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.