-
Notifications
You must be signed in to change notification settings - Fork 28
/
ringcentral.postman2.base.json
119 lines (119 loc) · 3.62 KB
/
ringcentral.postman2.base.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
{
"variables": [],
"info": {
"name": "RingCentral REST API",
"description": "This is a collection of API requests associated with the Basic usage plan in RingCentral Connect Platform for Sandbox Testing.\n\nPlease use a Postman environment with the following variables: RC_SERVER_HOSTNAME, RC_APP_KEY, RC_APP_SECRET, RC_USERNAME, RC_EXTENSION, RC_PASSWORD\n\nTo use these resources, you must ALWAYS start by executing one of the OAuth \"Auth\" Requests first, then you can use any other requests (for the 60 minutes that the access_token you obtained is valid).",
"schema": "https://schema.getpostman.com/json/collection/v2.0.0/collection.json"
},
"item": [
{
"name": "Auth",
"description": "YOU MUST UPDATE VALUES IN THE \"Pre-request Script\" section of ALL items in this folder to match your RingCentral Sandbox Account.",
"item": [
{
"name": "Fetch access_token",
"event": [
{
"listen": "test",
"script": {
"type": "text/javascript",
"exec": [
"var jsonData = JSON.parse(responseBody);",
"tests[\"Contains an access_token\"] = jsonData.hasOwnProperty('access_token');",
"",
"tests[\"Status code is 200\"] = responseCode.code === 200;",
"",
"postman.setEnvironmentVariable(\"my_access_token\", jsonData.access_token);"
]
}
},
{
"listen": "prerequest",
"script": {
"type": "text/javascript",
"exec": [
"// Populate the Postman environment with:",
"// RINGCENTRAL_SERVER_URL, RINGCENTRAL_CLIENT_ID, RINGCENTRAL_CLIENT_SECRET,",
"// RINGCENTRAL_USERNAME, RINGCENTRAL_EXTENSION, RINGCENTRAL_PASSWORD",
"var appKey = environment[\"RINGCENTRAL_CLIENT_ID\"];",
"var appSecret = environment[\"RINGCENTRAL_CLIENT_SECRET\"];",
"var apiKey = encodeBasicAuthHeader(appKey, appSecret);",
"",
"postman.setEnvironmentVariable(\"basic_auth_header\", \"Basic \".concat(apiKey));",
"",
"function encodeBasicAuthHeader(appKey, appSecret) {",
" var apiKey = appKey + ':' + appSecret;",
" return btoa(apiKey);",
"}"
]
}
}
],
"request": {
"url": {
"raw": "{{RINGCENTRAL_SERVER_URL}}/restapi/oauth/token",
"auth": null,
"host": [
"{{RINGCENTRAL_SERVER_URL}}"
],
"path": [
"restapi",
"oauth",
"token"
]
},
"method": "POST",
"header": [
{
"key": "Authorization",
"value": "{{basic_auth_header}}",
"description": ""
},
{
"key": "Accept",
"value": "application/json",
"description": ""
},
{
"key": "Content-Type",
"value": "application/x-www-form-urlencoded;charset=UTF-8",
"description": ""
}
],
"body": {
"mode": "urlencoded",
"urlencoded": [
{
"key": "grant_type",
"value": "password",
"type": "text",
"enabled": true
},
{
"key": "username",
"value": "{{RINGCENTRAL_USERNAME}}",
"type": "text",
"enabled": true
},
{
"key": "password",
"value": "{{RINGCENTRAL_PASSWORD}}",
"type": "text",
"enabled": true
},
{
"key": "extension",
"value": "{{RINGCENTRAL_EXTENSION}}",
"type": "text",
"enabled": true
}
]
},
"description": "Fetch access_token from DevTest environment as Admin"
},
"response": []
}
]
}
]
}