Python requestsモジュールを使用してKINTONEにデータを書き込む
フロー
- KINTONEで入れ物を作る
- Pythonからデータ送る
- うれしい
KITONEの入れ物
今回は、"Text1"というフィールドコードを持つアプリを作りました。
Pythonからデータを送る
"abcde"というデータを書き込みます。
#!/usr/bin/python
# _*_ coding: utf-8 _*_
import requests
URL = "https://◯◯◯◯.cybozu.com:443" # URL
APP_ID = "APP ID" # kintoneのアプリID
API_TOKEN = "API TOKEN" # kintoneのAPIトークン
class KINTONE:
def PostToKintone(self, url, appId, apiToken):
#KINTONE field code: Text1
record={'Text1':{'value' : 'abcde'}} #書き込むフィールドコードとデータ
data = {'app':appId,'record':record}
headers = {"X-Cybozu-API-Token": apiToken, "Content-Type" : "application/json"}
resp=requests.post(url+'/k/v1/record.json',json=data,headers=headers)
return resp
if __name__ == '__main__':
knt=KINTONE()
resp=knt.PostToKintone(URL, APP_ID, API_TOKEN)
print resp.text
アウトプットは
{"id":"1","revision":"1"}
となり幸せな気分になりました。
Author And Source
この問題について(Python requestsモジュールを使用してKINTONEにデータを書き込む), 我々は、より多くの情報をここで見つけました https://qiita.com/NoTASK/items/9301ff9b662e528fa23f著者帰属:元の著者の情報は、元のURLに含まれています。著作権は原作者に属する。
Content is automatically searched and collected through network algorithms . If there is a violation . Please contact us . We will adjust (correct author information ,or delete content ) as soon as possible .