简体   繁体   English

使用Python包装器PyPOdio在Podio中创建项目

[英]Create Item in Podio Using Python Wrapper PyPOdio

I am unable to create an item in PODIO using PYPODIO2 wrapper and the API. 我无法使用PYPODIO2包装器和API在PODIO中创建项目。 I have been able to successfully authorise using OAuth App Authentication. 我已经能够成功使用OAuth应用程序身份验证进行授权。 Below is the snippet of code that i am trying to execute but i run into an error 以下是我尝试执行的代码片段,但遇到错误

attributes={"fields": {"module-serial": serial_number,
                       "contract-manufacturer-name-2":"Extel",
                       "module-number-and-name":{ 
                                "status": "active",
                                "text": "BD201: Main Board Extended Build",
                                "id": 2},
                       "category":{
                               "status": "active",
                               "text": "Pass",
                               "id": 1}
                       }
            }

pcbapp.Item.create(17174065, attributes)

Error: pypodio2.transport.TransportException: TransportException({'server': 'nginx', 'date': 'Tue, 07 Feb 2017 05:49:05 GMT', 'content-type': 'application/json; charset=utf-8', 'content-length': '259', 'connection': 'keep-alive', 'x-rate-limit-remaining': '989', 'x-rate-limit-limit': '1000', 'x-podio-auth-ref': 'app_17174065', 'x-podio-request-id': 'yUWqV1ao', 'strict-transport-security': 'max-age=31535999', 'status': '400'}): {"error_parameters":{},"error_detail":null,"error_propagate":false,"request":{"url":"http://api.podio.com/item/app/17174065/","query_string":"","method":"POST"},"error_description":"Invalid value null (null): Not a valid option","error":"invalid_value"} 错误: pypodio2.transport.TransportException:TransportException({'server':'nginx','date':'Tue,07 Feb 2017 05:49:05 GMT','content-type':'application / json; charset = utf-8”,“ content-length”:“ 259”,“ connection”:“ keep-alive”,“ x-rate-limit-remaining”:“ 989”,“ x-rate-limit-limit”:“ 1000”,“ x-podio-auth-ref”:“ app_17174065”,“ x-podio-request-id”:“ yUWqV1ao”,“ strict-transport-security”:“ max-age = 31535999”,“状态” :'400'}):{“ error_parameters”:{},“ error_detail”:null,“ error_propagate”:false,“ request”:{“ url”:“ http://api.podio.com/item/app / 17174065 /“,” query_string“:”“,”方法“:” POST“},” error_description“:”无效值null(空):无效选项“,” error“:” invalid_value“}

Error description: Invalid value null (null): Not a valid option 错误说明: Invalid value null (null): Not a valid option

Most likely one of your fields is formatted wrong way. 您的字段之一很可能格式错误。 You should try fill them one by one to find problematic one, and then try different formats for last one. 您应该尝试将它们一个接一个地填充,以找到有问题的一种,然后为最后一种尝试不同的格式。

I would recommend you to start with category fields module-number-and-name and category and pass values like: 我建议您从类别字段module-number-and-name以及category并传递值,例如:

{
 ...........
 # passing array of id's only, without text and status
 "module-number-and-name" : [2], 
 "category" :               [1], 
 .........
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM