@@ -9,19 +9,10 @@ import (
9
9
)
10
10
11
11
const (
12
- GLOBAL_VARS_URL = "https://www.postman.com/_api/workspace/%s/globals"
13
- //Note: This is an undocumented API endpoint. The office API endpoint keeps returning 502.
14
- //We'll shift this once that behavior is resolved and stable.
15
- //Official API Endpoint: "https://api.getpostman.com/workspaces/%s/global-variables"
16
- //GLOBAL_VARS_URL = "https://api.getpostman.com/workspaces/%s/global-variables"
17
- WORKSPACE_URL = "https://api.getpostman.com/workspaces/%s"
18
- ENVIRONMENTS_URL = "https://api.getpostman.com/environments/%s"
19
- COLLECTIONS_URL = "https://api.getpostman.com/collections/%s"
20
-
21
- userAgent = "PostmanRuntime/7.26.8"
22
- alt_userAgent = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36"
23
- //Since we're using the undocumented API endpoint for global vars, we need a different user agent.
24
- //We'll shift this once that behavior is resolved and stable.
12
+ WORKSPACE_URL = "https://api.getpostman.com/workspaces/%s"
13
+ ENVIRONMENTS_URL = "https://api.getpostman.com/environments/%s"
14
+ COLLECTIONS_URL = "https://api.getpostman.com/collections/%s"
15
+ userAgent = "PostmanRuntime/7.26.8"
25
16
defaultContentType = "*"
26
17
)
27
18
@@ -70,10 +61,6 @@ type Environment struct {
70
61
VariableData `json:"environment"`
71
62
}
72
63
73
- type GlobalVars struct {
74
- VariableData `json:"data"`
75
- }
76
-
77
64
type Metadata struct {
78
65
WorkspaceUUID string
79
66
WorkspaceName string
@@ -88,7 +75,6 @@ type Metadata struct {
88
75
Link string //direct link to the folder (could be .json file path)
89
76
Type string //folder, request, etc.
90
77
EnvironmentName string
91
- GlobalID string // might just be FullID, not sure
92
78
VarType string
93
79
FieldName string
94
80
FieldType string
@@ -318,33 +304,6 @@ func (c *Client) GetWorkspace(workspaceUUID string) (Workspace, error) {
318
304
return obj .Workspace , nil
319
305
}
320
306
321
- // GetGlobalVariables returns the global variables for a given workspace
322
- func (c * Client ) GetGlobalVariables (workspace_uuid string ) (VariableData , error ) {
323
- obj := struct {
324
- VariableData VariableData `json:"data"`
325
- }{}
326
-
327
- url := fmt .Sprintf (GLOBAL_VARS_URL , workspace_uuid )
328
- r , err := c .getPostmanReq (url , map [string ]string {"User-Agent" : alt_userAgent })
329
- if err != nil {
330
- err = fmt .Errorf ("could not get global variables for workspace: %s" , workspace_uuid )
331
- return VariableData {}, err
332
- }
333
-
334
- body , err := io .ReadAll (r .Body )
335
- if err != nil {
336
- err = fmt .Errorf ("could not read response body for workspace: %s" , workspace_uuid )
337
- return VariableData {}, err
338
- }
339
- r .Body .Close ()
340
-
341
- if err := json .Unmarshal ([]byte (body ), & obj ); err != nil {
342
- err = fmt .Errorf ("could not unmarshal global variables JSON for workspace: %s" , workspace_uuid )
343
- return VariableData {}, err
344
- }
345
- return obj .VariableData , nil
346
- }
347
-
348
307
// GetEnvironmentVariables returns the environment variables for a given environment
349
308
func (c * Client ) GetEnvironmentVariables (environment_uuid string ) (VariableData , error ) {
350
309
obj := struct {
0 commit comments