AutodeskIntegration-Searchinfolderswithout3-leggedtoken
创始人
2024-11-12 11:30:05
0

在不使用三腿式令牌的情况下,在Autodesk集成中搜索文件夹的解决方案是使用二腿式令牌进行身份验证。

以下是一个Python代码示例,它使用二腿式令牌来搜索Autodesk中的文件夹:

import requests
import json

# Variables
base_url = "https://developer.api.autodesk.com"
client_id = ""
client_secret = ""
folder_id = ""
access_token = ""

# Get 2-legged access token
def get_access_token():
    url = base_url + "/authentication/v1/authenticate"
    scope = "data:read data:write data:create data:search bucket:create bucket:read account:read account:write"

    payload = {
        "client_id": client_id,
        "client_secret": client_secret,
        "grant_type": "client_credentials",
        "scope": scope
    }

    response = requests.post(url, data=payload)
    return json.loads(response.text)["access_token"]

# Search folders
def search_folders():
    headers = {
        "Authorization": "Bearer " + access_token,
        "Content-Type": "application/vnd.api+json"
    }

    url = base_url + "/data/v1/projects/{}/search".format(folder_id)
    payload = {
        "jsonapi": {
          "version": "1.0"
        },
        "filter": {
          "type": "folder",
          "attributes": {
            "name": "myFolder"
          }
        }
    }

    response = requests.post(url, headers=headers, data=json.dumps(payload))
    return json.loads(response.text)

access_token = get_access_token()
search_result = search_folders()
print(search_result)

相关内容

热门资讯

透视讲解"wepok... 透视讲解"wepokerplus万能挂"详细辅助透明教程(透视有用方法)1、许多玩家不知道wepok...
透视讲解"wepok... 透视讲解"wepoker黑侠辅助器正版下载"详细辅助高科技教程(好友助力码方法)准备好在wepoke...
透视辅助"德州私人局... 透视辅助"德州私人局脚本"详细辅助2025新版技巧(可以买辅助技巧);1.德州私人局脚本 ai辅助创...
透视存在"哈糖大菠萝... 1、透视存在"哈糖大菠萝可以开挂吗"详细辅助力荐教程(买脚本靠谱教程)2、进入游戏-大厅左侧-新手福...
透视计算"智星德州插... 《透视计算"智星德州插件2024最新版"详细辅助新2025版(可以破解游戏教程)》 智星德州插件20...
透视了解"xpoke... 透视了解"xpoker辅助器"详细辅助透牌教程(有机器人教程);1.xpoker辅助器 ai辅助创建...
透视好友房"wepo... 透视好友房"wepoker模拟器哪个"详细辅助2025新版总结(可以开辅助神器);建议优先通过wep...
透视玄学"wpk透视... 透视玄学"wpk透视插件"详细辅助专业教程(买脚本靠谱透明)关于wpk透视插件机制的,其中提到了后台...
透视辅助"aapok... 透视辅助"aapoker怎么选牌"详细辅助插件教程(私人局有透视攻略)关于aapoker怎么选牌机制...
透视实锤"wepok... 透视实锤"wepoker私人局辅助挂"详细辅助透牌教程(可以下载游戏攻略);大神普及一款德州ai内幕...