Skip to content

Latest commit

 

History

History
103 lines (74 loc) · 2.59 KB

orgs-vars.md

File metadata and controls

103 lines (74 loc) · 2.59 KB

Orgs Vars

orgsVars := client.OrgsVars()

Class Name

OrgsVars

Search Org Vars

Search vars

Example: /api/v1/orgs/:org_id/vars/search?vars=*

SearchOrgVars(
    ctx context.Context,
    orgId uuid.UUID,
    siteId *string,
    mVar *string,
    src *models.VarSourceEnum,
    limit *int,
    page *int) (
    models.ApiResponse[models.ResponseSearchVar],
    error)

Parameters

Parameter Type Tags Description
orgId uuid.UUID Template, Required -
siteId *string Query, Optional -
mVar *string Query, Optional -
src *models.VarSourceEnum Query, Optional -
limit *int Query, Optional Default: 100
Constraints: >= 0
page *int Query, Optional Default: 1
Constraints: >= 1

Response Type

models.ResponseSearchVar

Example Usage

ctx := context.Background()

orgId := uuid.MustParse("000000ab-00ab-00ab-00ab-0000000000ab")







limit := 100

page := 1

apiResponse, err := orgsVars.SearchOrgVars(ctx, orgId, nil, nil, nil, &limit, &page)
if err != nil {
    log.Fatalln(err)
} else {
    // Printing the result and response
    fmt.Println(apiResponse.Data)
    fmt.Println(apiResponse.Response.StatusCode)
}

Example Response (as JSON)

{
  "end": 1693952979,
  "limit": 10,
  "results": [
    {
      "created_time": 1618457655.384858,
      "modified_time": 1693610886.477805,
      "org_id": "0c160b7f-1027-4cd1-923b-744534c4b070",
      "site_id": "1519f016-4e41-47c0-a396-cce4d04bac0b",
      "src": "site",
      "var": "mvp"
    }
  ],
  "start": 1693949379,
  "total": 1
}

Errors

HTTP Status Code Error Description Exception Class
400 Bad Syntax ResponseHttp400Exception
401 Unauthorized ResponseHttp401ErrorException
403 Permission Denied ResponseHttp403ErrorException
404 Not found. The API endpoint doesn’t exist or resource doesn’ t exist ResponseHttp404Exception
429 Too Many Request. The API Token used for the request reached the 5000 API Calls per hour threshold ResponseHttp429ErrorException