Go SDK - How to patch AccessProfile?


I was looking at how to Patch an AccessProfile with the Go SDK. However, the example doesn’t seem to list a valid example i.e. it looks like an attempt to replace a description but actually it doesn’t because no new value for the field is specified.

Can anybody share an actual example of how to patch an AccessProfile with this SDK?

We are aware that our SDK docs could use a huge face lift, especially when it comes to individual API calls. We are investigating ways to improve those docs, but in the meantime I encourage you to checkout the SDK guide for Golang, especially the handcrafted example we have for a PATCH update.

Specifically, you need to create a patchArray variable that you will pass into the PATCH function. This code might work, but I haven’t tested it myself.

updatedDescription := `This is an updated description for the access profile.`
newDescriptionValue := v3.JsonPatchOperationValue{String: &updatedDescription}
patchArray := []v3.JsonPatchOperation{{Op: "replace", Path: "/description", Value: &newDescriptionValue}}

updatedAccessProfile, request, errorMessage := apiClient.V3.AccessProfilesAPI.PatchAccessProfile(ctx, id).JsonPatchOperation(patchArray).Execute()

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.