Projects endpoints
使用 /projects 端點來建立、讀取、更新和刪除 AgentBuilder 專案。
讀取專案
獲取 AgentBuilder 專案的列表,包括專案 ID、名稱和描述。
_10curl -X GET \_10 "$LANGFLOW_URL/api/v1/projects/" \_10 -H "accept: application/json" \_10 -H "x-api-key: $LANGFLOW_API_KEY"
Result
_10[_10 {_10 "name": "Starter Project",_10 "description": "Manage your own projects. Download and upload projects.",_10 "id": "1415de42-8f01-4f36-bf34-539f23e47466",_10 "parent_id": null_10 }_10]
建立專案
建立新專案。
_10curl -X POST \_10 "$LANGFLOW_URL/api/v1/projects/" \_10 -H "Content-Type: application/json" \_10 -H "x-api-key: $LANGFLOW_API_KEY" \_10 -d '{_10 "name": "new_project_name",_10 "description": "string",_10 "components_list": [],_10 "flows_list": []_10}'
Result
_10{_10 "name": "new_project_name",_10 "description": "string",_10 "id": "b408ddb9-6266-4431-9be8-e04a62758331",_10 "parent_id": null_10}
要在專案建立時新增FLOW和Components,請從 /all 和 /flows/read 端點檢索 components_list 和 flows_list 值,並將它們新增到請求主體。
將FLOW新增到專案會將FLOW從其先前位置移動。FLOW不會被複製。
_15curl -X POST \_15 "$LANGFLOW_URL/api/v1/projects/" \_15 -H "accept: application/json" \_15 -H "Content-Type: application/json" \_15 -H "x-api-key: $LANGFLOW_API_KEY" \_15 -d '{_15 "name": "new_project_name",_15 "description": "string",_15 "components_list": [_15 "3fa85f64-5717-4562-b3fc-2c963f66afa6"_15 ],_15 "flows_list": [_15 "3fa85f64-5717-4562-b3fc-2c963f66afa6"_15 ]_15}'
讀取專案
檢索特定專案的詳細資訊。
要找到專案的 UUID,請調用 讀取專案 端點。
_10curl -X GET \_10 "$LANGFLOW_URL/api/v1/projects/$PROJECT_ID" \_10 -H "accept: application/json" \_10 -H "x-api-key: $LANGFLOW_API_KEY"
Result
_10[_10 {_10 "name": "Starter Project",_10 "description": "Manage your own projects. Download and upload projects.",_10 "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",_10 "parent_id": null_10 }_10]
更新專案
使用 PATCH 請求更新特定專案的資訊。
每個 PATCH 請求都會使用您發送的值更新專案。 只有您在請求中包含的欄位才會被更新。 即使值未變更,如果您多次發送相同的值,更新仍會被處理。
_15curl -X PATCH \_15 "$LANGFLOW_URL/api/v1/projects/b408ddb9-6266-4431-9be8-e04a62758331" \_15 -H "accept: application/json" \_15 -H "x-api-key: $LANGFLOW_API_KEY" \_15 -d '{_15 "name": "string",_15 "description": "string",_15 "parent_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",_15 "components": [_15 "3fa85f64-5717-4562-b3fc-2c963f66afa6"_15 ],_15 "flows": [_15 "3fa85f64-5717-4562-b3fc-2c963f66afa6"_15 ]_15}'
Result
_10{_10 "name": "string",_10 "description": "string",_10 "id": "b408ddb9-6266-4431-9be8-e04a62758331",_10 "parent_id": null_10}
刪除專案
刪除特定專案。
_10curl -X DELETE \_10 "$LANGFLOW_URL/api/v1/projects/$PROJECT_ID" \_10 -H "accept: */*" \_10 -H "x-api-key: $LANGFLOW_API_KEY"
Result
_10204 No Content
匯出專案
將專案中的所有FLOW下載為 zip 檔案。
--output 旗標是可選的。
_10curl -X GET \_10 "$LANGFLOW_URL/api/v1/projects/download/$PROJECT_ID" \_10 -H "accept: application/json" \_10 -H "x-api-key: $LANGFLOW_API_KEY" \_10 --output langflow-project.zip
匯入專案
通過上傳 AgentBuilder 專案 zip 檔案來匯入專案及其FLOW:
_10curl -X POST \_10 "$LANGFLOW_URL/api/v1/projects/upload/" \_10 -H "accept: application/json" \_10 -H "Content-Type: multipart/form-data" \_10 -H "x-api-key: $LANGFLOW_API_KEY" \_10 -F "file=@20241230_135006_langflow_flows.zip;type=application/zip"