|
11 | 11 | "name": "OAuth Token", |
12 | 12 | "item": [ |
13 | 13 | { |
14 | | - "name": "Auth Request", |
| 14 | + "name": "Get OAuth Token for Resource Owner environments", |
15 | 15 | "event": [ |
16 | 16 | { |
17 | 17 | "listen": "test", |
|
28 | 28 | "pm.environment.set(\"MyGUID\", myUUID);\r", |
29 | 29 | "pm.environment.set(\"HashedAppKey\", CryptoJS.SHA256(pm.environment.get(\"AppKey\")).toString());" |
30 | 30 | ], |
31 | | - "type": "text/javascript" |
| 31 | + "type": "text/javascript", |
| 32 | + "packages": {} |
32 | 33 | } |
33 | 34 | } |
34 | 35 | ], |
35 | 36 | "request": { |
36 | 37 | "auth": { |
37 | | - "type": "basic" |
| 38 | + "type": "basic", |
| 39 | + "basic": [ |
| 40 | + { |
| 41 | + "key": "password", |
| 42 | + "value": "{{CLIENT_SECRET}}", |
| 43 | + "type": "string" |
| 44 | + }, |
| 45 | + { |
| 46 | + "key": "username", |
| 47 | + "value": "{{CLIENT_ID}}", |
| 48 | + "type": "string" |
| 49 | + }, |
| 50 | + { |
| 51 | + "key": "saveHelperData", |
| 52 | + "value": true, |
| 53 | + "type": "boolean" |
| 54 | + }, |
| 55 | + { |
| 56 | + "key": "showPassword", |
| 57 | + "value": false, |
| 58 | + "type": "boolean" |
| 59 | + } |
| 60 | + ] |
38 | 61 | }, |
39 | 62 | "method": "POST", |
40 | 63 | "header": [ |
|
80 | 103 | "v1", |
81 | 104 | "tokens" |
82 | 105 | ] |
| 106 | + }, |
| 107 | + "description": "Use this API to request an oAuth token when the environment is a Resource Owner environment. You can see which oAuth flow an environment supports by looking at the Environment page in the OHIP Developer Portal. For more information see (Authenticating to Oracle Hospitality Property APIs)\\[[https://docs.oracle.com/en/industries/hospitality/integration-platform/ohipu/c_oracle_hospitality_property_apis.htm#AuthenticatingToOracleHospitalityPr-1BD54F80](https://docs.oracle.com/en/industries/hospitality/integration-platform/ohipu/c_oracle_hospitality_property_apis.htm#AuthenticatingToOracleHospitalityPr-1BD54F80)\\] under the heading \"Resource Owner-Based Authentication\".\n\nTo call this API you will need:\n\n1. To know the environment is a Resource Owner environment - see above\n2. A valid ClientId and ClientSecret\n3. An integration user and its password that has been approved by the environment owner\n4. A valid application key\n \n\nBecause of this, oAuth tokens may only be used when calling the given environment.\n\noAuth tokens expire after 60 minutes. We recommend obtaining a new oAuth token every 50 minutes, but not more frequently." |
| 108 | + }, |
| 109 | + "response": [] |
| 110 | + }, |
| 111 | + { |
| 112 | + "name": "Get OAuth Token for Client Credentials environments", |
| 113 | + "event": [ |
| 114 | + { |
| 115 | + "listen": "test", |
| 116 | + "script": { |
| 117 | + "exec": [ |
| 118 | + "var jsonData = JSON.parse(responseBody);\r", |
| 119 | + "postman.setEnvironmentVariable(\"Token\", jsonData.access_token);\r", |
| 120 | + "//Set currentdate and currentdateplus1 variables\r", |
| 121 | + "var moment = require('moment');\r", |
| 122 | + "pm.environment.set('currentdate', moment().format((\"YYYY-MM-DD\")))\r", |
| 123 | + "pm.environment.set('currentdateplus1', moment().add(1, 'days').format((\"YYYY-MM-DD\")))\r", |
| 124 | + "var uuid = require('uuid');\r", |
| 125 | + "var myUUID = uuid.v4();\r", |
| 126 | + "pm.environment.set(\"MyGUID\", myUUID);\r", |
| 127 | + "pm.environment.set(\"HashedAppKey\", CryptoJS.SHA256(pm.environment.get(\"AppKey\")).toString());" |
| 128 | + ], |
| 129 | + "type": "text/javascript", |
| 130 | + "packages": {} |
| 131 | + } |
83 | 132 | } |
| 133 | + ], |
| 134 | + "request": { |
| 135 | + "auth": { |
| 136 | + "type": "basic", |
| 137 | + "basic": [ |
| 138 | + { |
| 139 | + "key": "password", |
| 140 | + "value": "{{CLIENT_SECRET}}", |
| 141 | + "type": "string" |
| 142 | + }, |
| 143 | + { |
| 144 | + "key": "username", |
| 145 | + "value": "{{CLIENT_ID}}", |
| 146 | + "type": "string" |
| 147 | + }, |
| 148 | + { |
| 149 | + "key": "undefined", |
| 150 | + "type": "any" |
| 151 | + } |
| 152 | + ] |
| 153 | + }, |
| 154 | + "method": "POST", |
| 155 | + "header": [ |
| 156 | + { |
| 157 | + "key": "Content-Type", |
| 158 | + "name": "Content-Type", |
| 159 | + "type": "text", |
| 160 | + "value": "application/x-www-form-urlencoded" |
| 161 | + }, |
| 162 | + { |
| 163 | + "key": "x-app-key", |
| 164 | + "type": "text", |
| 165 | + "value": "{{AppKey}}" |
| 166 | + }, |
| 167 | + { |
| 168 | + "key": "enterpriseId", |
| 169 | + "value": "{{EnterpriseId}}", |
| 170 | + "type": "text" |
| 171 | + } |
| 172 | + ], |
| 173 | + "body": { |
| 174 | + "mode": "urlencoded", |
| 175 | + "urlencoded": [ |
| 176 | + { |
| 177 | + "key": "grant_type", |
| 178 | + "value": "client_credentials", |
| 179 | + "type": "text" |
| 180 | + }, |
| 181 | + { |
| 182 | + "key": "scope", |
| 183 | + "value": "urn:opc:hgbu:ws:__myscopes__", |
| 184 | + "type": "text" |
| 185 | + } |
| 186 | + ] |
| 187 | + }, |
| 188 | + "url": { |
| 189 | + "raw": "{{HostName}}/oauth/v1/tokens", |
| 190 | + "host": [ |
| 191 | + "{{HostName}}" |
| 192 | + ], |
| 193 | + "path": [ |
| 194 | + "oauth", |
| 195 | + "v1", |
| 196 | + "tokens" |
| 197 | + ] |
| 198 | + }, |
| 199 | + "description": "Use this API to request an oAuth token when the environment is a Client Credentials environment. You can see which oAuth flow an environment supports by looking at the Environment page in the OHIP Developer Portal. For more information see (Authenticating to Oracle Hospitality Property APIs)\\[[https://docs.oracle.com/en/industries/hospitality/integration-platform/ohipu/c_oracle_hospitality_property_apis.htm#AuthenticatingToOracleHospitalityPr-1BD54F80](https://docs.oracle.com/en/industries/hospitality/integration-platform/ohipu/c_oracle_hospitality_property_apis.htm#AuthenticatingToOracleHospitalityPr-1BD54F80)\\] under the heading \"Client Credentials-Based Authentication\".\n\nTo call this API you will need:\n\n1. To know the environment is a Client Credentials environment - see above\n2. A valid ClientId and ClientSecret\n3. A valid EnterpriseId\n4. A valid application key\n \n\nBecause of this, oAuth tokens may only be used when calling the given environment.\n\noAuth tokens expire after 60 minutes. We recommend obtaining a new oAuth token every 50 minutes, but not more frequently." |
84 | 200 | }, |
85 | 201 | "response": [] |
86 | 202 | } |
|
8642 | 8758 | } |
8643 | 8759 | ], |
8644 | 8760 | "url": { |
8645 | | - "raw": "{{HostName}}/blk/v1/blocks/statistics?statisticalCode=ArrivalsTotal&statisticalCode=InHouseBlocksTotal&reportCode=BlockArrivals&hotelId={{HotelId}}&reportStartDate=2024-08-01&", |
| 8761 | + "raw": "{{HostName}}/blk/v1/blocks/statistics?statisticalCode=ArrivalsTotal&statisticalCode=InHouseBlocksTotal&reportCode=BlockArrivals&hotelId={{HotelId}}&reportStartDate=2024-08-01", |
8646 | 8762 | "host": [ |
8647 | 8763 | "{{HostName}}" |
8648 | 8764 | ], |
|
0 commit comments