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)

相关内容

热门资讯

普及透视!hhpoker免费透... 普及透视!hhpoker免费透视脚本,wpk透视怎么安装,模块教程(有挂秘诀)-哔哩哔哩所有人都在同...
关于透视!wejoker手机版... 关于透视!wejoker手机版透视脚本,拱趴游戏破解器,技法教程(有挂技术)-哔哩哔哩关于透视!we...
关于透视!wpk安卓下载辅助,... 关于透视!wpk安卓下载辅助,sohoo竞技联盟辅助器,模板教程(有挂技巧)-哔哩哔哩sohoo竞技...
解迷透视!hhpkoer辅助挂... 解迷透视!hhpkoer辅助挂是真的吗,wepoker透视底牌脚本,策略教程(有挂方针)-哔哩哔哩1...
解谜透视!aapoker怎么选... 解谜透视!aapoker怎么选牌,德普辅助器怎么用,技法教程(有挂解惑)-哔哩哔哩1、德普辅助器怎么...
分享透视!wepoker如何设... 分享透视!wepoker如何设置透视,wepoker免费透视,攻略教程(有挂秘笈)-哔哩哔哩1、we...
有挂透视!wpk透视是真的假的... 有挂透视!wpk透视是真的假的,菠萝辅助器免费版的特点,烘培教程(有挂细节)-哔哩哔哩1、进入到菠萝...
教你透视!pokemmo辅助工... 教你透视!pokemmo辅助工具,wepoker有辅助器吗,窍要教程(真的有挂)-哔哩哔哩1、wep...
解谜透视!wepokerplu... 解谜透视!wepokerplus透视脚本免费,hhpoker辅助器,课程教程(有挂技巧)-哔哩哔哩1...
揭露透视!哈糖大菠萝攻略,hh... 揭露透视!哈糖大菠萝攻略,hhpoker是内部控制吗,教材教程(揭秘有挂)-哔哩哔哩1、操作简单,无...