我正在尝试将大型json数据从android改造客户端上传到django rest api视图。
例如(Json数据):
{'post_data': [{'x':'asdkdadlf fdsfsd','y':'This is a paragraph........ Ending paragraph', 'created_on':'2018-22-08'},
{'x':'asdkdadlf fdsfsd','y':'This is a paragraph........ Ending paragraph', 'created_on':'2018-22-08'},
{'x':'asdkdadlf fdsfsd','y':'This is a paragraph........ Ending paragraph', 'created_on':'2018-22-08'},
....
{'x':'asdkdadlf fdsfsd','y':'This is a paragraph........ Ending paragraph', 'created_on':'2018-22-08'},
{'x':'asdkdadlf fdsfsd','y':'This is a paragraph........ Ending paragraph', 'created_on':'2018-22-08'},
]}`
API响应输出:
08-22 13:21:12.964 15628-16104/com.mml.wapp D/Abhay: Group type: 1 group name: REAL ESTATE PROPERTYfrom:+234 818 230 9054
08-22 13:21:12.995 15628-16104/com.mml.wapp D/Abhay: Total messages in db before adding current message: 100
08-22 13:21:13.062 15628-16104/com.mml.wapp D/deleteMessage: Deleted all messages
08-22 13:21:13.200 15628-16109/com.mml.wapp D/OkHttp: --> POST https://api.multiplymyleads.com/api/upload_whatsapp_msgs/ http/1.1
Content-Type: application/x-www-form-urlencoded
08-22 13:21:13.204 15628-16109/com.mml.wapp D/OkHttp: Content-Length: 73304
08-22 13:21:13.211 15628-16109/com.mml.wapp D/OkHttp: postdata=%7B%22%E2%80%AA%2B234%20818%20230%209054%E2%80%AC%22%3A%5B%7B%22group_type%22%3A%221%22%2C%22time%22%3A%222018-08-
... followed by a lot more of that
据我了解,上述响应中的数据似乎很大,这可能就是为什么它会超时错误的原因?由于无法在给定的超时时间内在服务器端通过一个API调用上传所有数据。
我们该如何解决上述问题?
如果减小json post_data的大小,我已经检查API返回成功响应。
我正在android端使用Retrofit 2.0客户端进行API调用。