Search code examples
restalm

ALM 12: Authentication via REST returns 400 bad request


I am following the guidance here: http://alm-help.saas.hp.com/en/12.50/api_refs/REST_TECH_PREVIEW/Content/General/Session_Management.html

I send the following request to alm12.test.com/qcbin/authentication-point/alm-authenticate

Headers:

Content-Type: application/xml Accept: application/xml

Request

<?xml version='1.0' encoding='utf-8'?><alm-authentication><user>userxy</user><password>yyy</password></alm-authentication>

Which results in the following repsonse (LWSSO_COOKIE_KEY): Content-Length: 0 Date: Mon, 02 May 2016 13:28:00 GMT Set-Cookie: LWSSO_COOKIE_KEY=o1MfQIVWQg2x09CKUlkqARQsRHAhvADYsKhl4AM2ARiJpJesV_fA6xVeYbm4ek1CPdbmmsOGMaCORTsOmHMJVa3V5JKQLIywiubZQQtFfV15PS82qj4bRJ6mhmGqZU6XU8DMPLYuSLfRjfjLrxtix6cMHD1JpdlYHhTxfbo5No62s36Hw8UH12lZlrGzPfY_EFJE8k28TPqflXJQccdHErbCG8.;Path=/;HTTPOnly Server: Jetty(7.5.4.v20111024)

No I send a request to alm12.test.com/qcbin/rest/site-session to open a session Header Content-Type: application/xml Accept: application/xml Cookie: LWSSO_COOKIE_KEY=o1MfQIVWQg2x09CKUlkqARQsRHAhvADYsKhl4AM2ARiJpJesV_fA6xVeYbm4ek1CPdbmmsOGMaCORTsOmHMJVa3V5JKQLIywiubZQQtFfV15PS82qj4bRJ6mhmGqZU6XU8DMPLYuSLfRjfjLrxtix6cMHD1JpdlYHhTxfbo5No62s36Hw8UH12lZlrGzPfY_EFJE8k28TPqflXJQccdHErbCG8.;Path=/;HTTPOnly

Unfortunately I just get an error code 400 - Bad Request.

What am I doing wrong?


Solution

  • I had the same error, after removing the following everything works.

    Type: application/xml Accept: application/xml

    So your request should have only LWSSO_COOKIE_KEY cookie without any other headers