我有自定义笔记创建API。设计模型的方式
postURL = "http://localhost/api/v1/notes/"
addNote = {
'title': noteTitle,
'text' : noteText,
'location' : noteLocation,
'lock' : '0',
'tags' : noteTags
}
这将提供notesID。
http://localhost/api/v1/notes/images/
http://localhost/api/v1/notes/videos/
def getAddNote():
token=getToken()
noteTitle=input("Enter Note Title: ")
noteText=input("Enter Note Text: ")
noteLocation=input("Enter Note Location: ")
noteTagsInput=input("Enter Note Tags: ")
tagList = noteTagsInput.split(",")
print(tagList)
tagList_=', '.join(map(lambda x: '"' + x + '"', tagList))
noteTags="["+tagList_+"]"
postURL = "http://localhost/api/v1/notes/"
addNote = {
'title': noteTitle,
'text' : noteText,
'location' : noteLocation,
'lock' : '0',
'tags' : noteTags
}
print(addNote)
postrequest = requests.post(postURL , headers={'Authorization': 'Token {}'.format(token),'Content-Type': 'application/json'}, data=json.dumps(addNote))
问题:是否可以在一个事务中进行3个POST调用?
我想通过客户端应用程序提交一张照片和视频吗?