OlexandrStepanov / swift-webaction-binary

Sample for OpenWhisk web action using Swift binary.
Apache License 2.0
0 stars 1 forks source link

Changed parameter values from `ow_meta` to correct idenfiers. #1

Closed jthomas closed 6 years ago

jthomas commented 6 years ago

I found three tiny issues due to outdated documentation in Rob's blog post.

Invoking this web action with the correct header return the unix time values.

$ http get https://openwhisk.ng.bluemix.net/api/v1/web/james.thomas@uk.ibm.com_dev/default/swift-packages-dev-time X-Client-Id:SOME
_CLIENT_ID
HTTP/1.1 200 OK
Access-Control-Allow-Headers: Authorization, Content-Type
Access-Control-Allow-Methods: OPTIONS, GET, DELETE, POST, PUT, HEAD, PATCH
Access-Control-Allow-Origin: *
Connection: Keep-Alive
Content-Type: application/json
Date: Thu, 25 Jan 2018 17:38:19 GMT
IBM_Cloud_Functions: OpenWhisk
Server: nginx/1.11.13
Set-Cookie: DPJSESSIONID=PBC5YS:-2098699314; Path=/; Domain=.whisk.ng.bluemix.net
Transfer-Encoding: chunked
X-Backside-Transport: OK OK
X-Global-Transaction-ID: 1041013407

{
    "unixtime": "1516901899"
}

If I am missing the client header, it returns the 401.

$ http get https://openwhisk.ng.bluemix.net/api/v1/web/james.thomas@uk.ibm.com_dev/default/swift-packages-dev-time
HTTP/1.1 401 Unauthorized
Access-Control-Allow-Headers: Authorization, Content-Type
Access-Control-Allow-Methods: OPTIONS, GET, DELETE, POST, PUT, HEAD, PATCH
Access-Control-Allow-Origin: *
Connection: Keep-Alive
Content-Type: application/json
Date: Thu, 25 Jan 2018 17:39:45 GMT
IBM_Cloud_Functions: OpenWhisk
Server: nginx/1.11.13
Set-Cookie: DPJSESSIONID=PBC5YS:1376290542; Path=/; Domain=.whisk.ng.bluemix.net
Transfer-Encoding: chunked
X-Backside-Transport: FAIL FAIL
X-Global-Transaction-ID: 1503782439

{
    "error": "Client Id is missing or wrong"
}
OlexandrStepanov commented 6 years ago

Hi James,

Thanks a lot for the correction.

I was confused, because if you call http get https://openwhisk.ng.bluemix.net/api/v1/web/james.thomas@uk.ibm.com_dev/default/swift-packages-dev-time.json X-Client-Id:SOME_CLIENT_ID (with .json ending in url), you will get not interpreted JSON, the one with body, headers and statusCode. Not sure is this a bug or a feature.