{"action":"created","issue":{"url":"https://api.github.com/repos/apache/incubator-openwhisk-apigateway/issues/311","repository_url":"https://api.github.com/repos/apache/incubator-openwhisk-apigateway","labels_url":"https://api.github.com/repos/apache/incubator-openwhisk-apigateway/issues/311/labels{/name}","comments_url":"https://api.github.com/repos/apache/incubator-openwhisk-apigateway/issues/311/comments","events_url":"https://api.github.com/repos/apache/incubator-openwhisk-apigateway/issues/311/events","html_url":"https://github.com/apache/incubator-openwhisk-apigateway/issues/311","id":330979103,"node_id":"MDU6SXNzdWUzMzA5NzkxMDM=","number":311,"title":"Expose base path to the action","user":{"login":"akrabat","id":33135,"node_id":"MDQ6VXNlcjMzMTM1","avatar_url":"https://avatars2.githubusercontent.com/u/33135?v=4","gravatar_id":"","url":"https://api.github.com/users/akrabat","html_url":"https://github.com/akrabat","followers_url":"https://api.github.com/users/akrabat/followers","following_url":"https://api.github.com/users/akrabat/following{/other_user}","gists_url":"https://api.github.com/users/akrabat/gists{/gist_id}","starred_url":"https://api.github.com/users/akrabat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/akrabat/subscriptions","organizations_url":"https://api.github.com/users/akrabat/orgs","repos_url":"https://api.github.com/users/akrabat/repos","events_url":"https://api.github.com/users/akrabat/events{/privacy}","received_events_url":"https://api.github.com/users/akrabat/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-06-10T15:44:28Z","updated_at":"2018-06-14T17:05:55Z","closed_at":null,"author_association":"NONE","body":"I'm trying to find a way to determine the fully qualified base URL that was used for my action so that I can create URLs in my payloads to other resources in my API.\r\n\r\ne.g. if you set up as per https://github.com/apache/incubator-openwhisk/blob/master/docs/apigateway.md#exposing-multiple-web-actions then:\r\n* Given a POST /club/books, I need to generate a URL to /club/books/{new id}\r\n* Given a GET to /club/books/12, then I want to generate a URL to /club/books/34 which is by the same author.\r\n\r\nAs it stands, we have:\r\n\r\n* `__ow_headers` => `x-forwarded-url` which provides the fully qualified URL that was used to invoke this action\r\n* `__ow_path` which is some characters from the end of the `x-forwarded-url` URL.\r\n\r\nMy initial idea was to subtract `__ow_path` from `__ow_headers`, but it doesn't work as `__ow_path` is very different depending on if there's a placeholder in the path:\r\n\r\ni.e. if you call the URL for `/club/books/`, then `__ow_path` is `/`, but if you call the URL for `/club/books/12` the `__ow_path` is `/club/books/12`\r\n\r\n*Suggested solution:*\r\n\r\nProvide `__ow_base_path` which is equal to `/club` in this example. \r\n"},"comment":{"url":"https://api.github.com/repos/apache/incubator-openwhisk-apigateway/issues/comments/397368510","html_url":"https://github.com/apache/incubator-openwhisk-apigateway/issues/311#issuecomment-397368510","issue_url":"https://api.github.com/repos/apache/incubator-openwhisk-apigateway/issues/311","id":397368510,"node_id":"MDEyOklzc3VlQ29tbWVudDM5NzM2ODUxMA==","user":{"login":"ddragosd","id":541933,"node_id":"MDQ6VXNlcjU0MTkzMw==","avatar_url":"https://avatars0.githubusercontent.com/u/541933?v=4","gravatar_id":"","url":"https://api.github.com/users/ddragosd","html_url":"https://github.com/ddragosd","followers_url":"https://api.github.com/users/ddragosd/followers","following_url":"https://api.github.com/users/ddragosd/following{/other_user}","gists_url":"https://api.github.com/users/ddragosd/gists{/gist_id}","starred_url":"https://api.github.com/users/ddragosd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ddragosd/subscriptions","organizations_url":"https://api.github.com/users/ddragosd/orgs","repos_url":"https://api.github.com/users/ddragosd/repos","events_url":"https://api.github.com/users/ddragosd/events{/privacy}","received_events_url":"https://api.github.com/users/ddragosd/received_events","type":"User","site_admin":false},"created_at":"2018-06-14T17:05:55Z","updated_at":"2018-06-14T17:05:55Z","author_association":"CONTRIBUTOR","body":"> Provide __ow_base_path which is equal to /club in this example.\r\n\r\nI think we can also assume that when developers use `swagger` spec, that `basePath` would be `/club` ?"}}
{"actor":{"display_login":"ddragosd"}}