Adrian_Santamaria | 2024-01-11 18:07:47 UTC | #1
Hello
There are a couple of errors in the SDK Go examples in the API Explorer. For example, let's take a look to GET /api/v2/flows:
config := platformclientv2.GetDefaultConfiguration()
config.BasePath = "" // expected format: mypurecloud.com
config.AccessToken = "your_access_token" // or use AuthorizeClientCredentials(...), AuthorizeCodeGrant(...) or AuthorizePKCEGrant(...)
apiInstance := platformclientv2.NewArchitectApiWithConfig(config)
var varType []string // Type
var pageNumber int // Page number
var pageSize int // Page size
var sortBy string // Sort by
var sortOrder string // Sort order
var id []string // ID
var name string // Name
var description string // Description
var nameOrDescription string // Name or description
var publishVersionId string // Publish version ID
var editableBy string // Editable by
var lockedBy string // Locked by
var lockedByClientId string // Locked by client ID
var secure string // Secure
var deleted bool // Include deleted
var includeSchemas bool // Include variable schemas
var publishedAfter string // Published after
var publishedBefore string // Published before
var divisionId []string // division ID(s)
// Get a pageable list of flows, filtered by query parameters
data, response, err := apiInstance.GetFlows(varType, pageNumber, pageSize, sortBy, sortOrder, id, name, description, nameOrDescription, publishVersionId, editableBy, lockedBy, lockedByClientId, secure, deleted, includeSchemas, publishedAfter, publishedBefore, divisionId)
fmt.Printf("Response:\n Success: %v\n Status code: %v\n Correlation ID: %v\n Body: %v\n", response.IsSuccess, response.StatusCode, response.CorrelationID, data.String())
if err != nil {
fmt.Printf("Error calling GetFlows: %v\n", err)
}
The BasePath format that the config is expecting is wrong. It has to include https://.
Also, the error is being handled after printing the response. It should be before.
John_Carnell | 2024-01-11 21:39:51 UTC | #2
Hi Adrian,
Thanks for letting us know. I will open ticket and get someone to take a look at it in our next Sprint.
Thanks, John Carnell Director, Developer Engagement
system | 2024-02-10 21:40:32 UTC | #3
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
This post was migrated from the old Developer Forum.
ref: 24078