B2B Integration

 View Only
  • 1.  SSPCM REST APIs

    Posted Wed November 25, 2020 06:16 PM
    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
    Ibm remove preview
    View this on Ibm >



    thanks in advance

    ------------------------------
    Alejandro Rodriguez
    ------------------------------

    #B2BIntegration
    #SupplyChain


  • 2.  RE: SSPCM REST APIs

    Posted Wed November 25, 2020 06:52 PM
    Edited by System Wed March 22, 2023 11:53 AM
    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
    ------------------------------



  • 3.  RE: SSPCM REST APIs

    Posted Wed November 25, 2020 07:29 PM
    It worked!!

    curl -k -H "X-Authentication: 4b51313272614c56454f57355573776c4a39347073773d3d" -X GET 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>{"userId":"someuser"}</objectsList><results/></XmlResponse>


    To obtain adapters!!
    curl -k -H "X-Authentication: 4b51313272614c56454f57355573776c4a39347073773d3d" -X GET https://127.0.0.1:8443/sspcmrest/sspcm/rest/adapter/getAllAdapters
    <?xml version="1.0" encoding="UTF-8" standalone="yes"?><XmlResponse><httpCode>200</httpCode><httpStatus>OK</httpStatus><action>None</action><messageLevel>INFO</messageLevel><objectsList>


    !!!

    ------------------------------
    Alejandro Rodriguez
    ------------------------------