REST API knowledge exchange
Post Reply
rwgustason
Novice
Posts: 9
Liked: 3 times
Joined: Aug 13, 2019 1:22 pm
Full Name: Ryan Gustason
Contact:

Use curl to close an API session login

Post by rwgustason »

I am trying to send a DELETE to close my API session in a script using curl on a Linux server. Here's the command:

Code: Select all

curl -X DELETE -k https://enterprisemanager:9398/api/logonSessions/*****sessionidstring*******
When I run that command I get:

Code: Select all

{"FirstChanceExceptionMessage":null,"StackTrace":null,"Message":"Identity was not authenticated.","StatusCode":401,"Status":"Unauthorized"}
I think I need a 204 return according to the documentation but I don't know what is wrong with my syntax to properly close my Enterprise Manager API session.

Any thoughts?
rwgustason
Novice
Posts: 9
Liked: 3 times
Joined: Aug 13, 2019 1:22 pm
Full Name: Ryan Gustason
Contact:

Re: Use curl to close an API session login

Post by rwgustason » 2 people like this post

Nevermind, I found an answer.

Code: Select all

curl -X DELETE -v -k https://enterprisemanager:9398/api/logonSessions/*****sessionid*********** -H "X-RestSvcSessionId: *****X-RestSvcSessionId******"
Returns:

Code: Select all

* Connection state changed (MAX_CONCURRENT_STREAMS == 100)!
< HTTP/2 204 
< server: Microsoft-HTTPAPI/2.0
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest