It worked!!
curl -k -H "Content-Type: application/json" --data '{"userId":"anyuser","password":"somepass"}' -X POST
https://127.0.0.1:8443/sspcmrest/sspcm/rest/session<?xml version="1.0" encoding="UTF-8" standalone="yes"?><XmlResponse><httpCode>200</httpCode><httpStatus>OK</httpStatus><action>None</action><messageLevel>INFO</messageLevel><objectsList>{"sessionToken":"796d5a4d37554e55376f76467371657078444f3147673d3d"}</objectsList><results/></XmlResponse>
However I am not able to check if the token is correct
for example:
POST a new token
curl -k -H "Content-Type: application/json" --data '{"userId":"anyuser","password":"somepass"}' -X POST
https://127.0.0.1:8443/sspcmrest/sspcm/rest/session <?xml version="1.0" encoding="UTF-8" standalone="yes"?><XmlResponse><httpCode>200</httpCode><httpStatus>OK</httpStatus><action>None</action><messageLevel>INFO</messageLevel><objectsList>{"sessionToken":"6948577778636e7747655847554e6c697738564872413d3d"}</objectsList><results/></XmlResponse>
GET the status of TOKEN:
curl -k -H "Content-Type: application/json" -X GET
https://180.181.105.93:8443/sspcmrest/sspcm/rest/session -d "X-Authentication":"6948577778636e7747655847554e6c697738564872413d3d"
<?xml version="1.0" encoding="UTF-8" standalone="yes"?><XmlResponse><httpCode>400</httpCode><httpStatus>BAD_REQUEST</httpStatus><action>Please correct the error where applicable, and retry.</action><message>Please provide a valid session token.</message><messageLevel>WARN</messageLevel><results/></XmlResponse>
------------------------------
Alejandro Rodriguez
------------------------------
Original Message:
Sent: Wed November 25, 2020 06:16 PM
From: Alejandro Rodriguez
Subject: SSPCM REST APIs
Hi! I am having some troubles in simple POST (to get token). Any ideas?
here is my command line:
curl -k -X POST https://127.0.0.1:8443/sspcmrest/sspcm/rest/session -d "userId":"someuser" -d "password":"somepass"
And I am having this error:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<title>Error 415 Unsupported Media Type</title>
</head>
<body><h2>HTTP ERROR 415</h2>
<p>Problem accessing /sspcmrest/sspcm/rest/session. Reason:
<pre> Unsupported Media Type</pre></p>
</body>
</html>
However I am following this note:
https://www.ibm.com/support/knowledgecenter/SS6PNW_3.4.3/com.ibm.help.ssp.apis.doc/Session/rest_api_post.html
thanks in advance
------------------------------
Alejandro Rodriguez
------------------------------
#B2BIntegration
#SupplyChain