Open gllxdxw075 opened 6 months ago
package test import ( "context" "fmt" "net/http" "testing" lark "github.com/larksuite/oapi-sdk-go/v3" larkcore "github.com/larksuite/oapi-sdk-go/v3/core" larksheets "github.com/larksuite/oapi-sdk-go/v3/service/sheets/v3" ) func TestFeshu(t *testing.T) { header := http.Header{} header.Add("Authorization", "my user token") cli := lark.NewClient( "id", "sec", lark.WithHeaders(header)) resp, err := cli.Sheets.V3.Spreadsheet.Patch( context.Background(), larksheets.NewPatchSpreadsheetReqBuilder(). SpreadsheetToken("sheettoken"). UpdateSpreadsheetProperties( larksheets. NewUpdateSpreadsheetPropertiesBuilder(). Title("test").Build(), ).Build()) //处理错误 if err != nil { // 处理err return } // 服务端错误处理 if !resp.Success() { fmt.Println(resp.Code, resp.Msg, resp.RequestId()) return } // 业务数据处理 fmt.Println(larkcore.Prettify(resp.RawBody)) }
按照上面的测试(替换对应的ID和TOKEN),会报错Access denied. One of the following scopes is required: [sheets:spreadsheet, drive:drive]
备注:
按照上面的测试(替换对应的ID和TOKEN),会报错Access denied. One of the following scopes is required: [sheets:spreadsheet, drive:drive]