Many park friends are trying Sina Weibo APIs and have developed many applications. During the development process, the API documentation has a great role. If the parameter values and the structure of returned data are clearly described, developers can spend a lot of time exploring. Although the documentation of Douban API is not perfect, it is already very good. Weibo API documentation, especially the example of returned data. The field meanings indicate that there are some problems that do not match the actual conditions, which brings a lot of trouble to developers. We look forward to a tool for API debugging. You can edit API parameters and send API requests to conveniently view the returned data. With an idea, I began to drum up and name it "Weibo API debugging platform ".
Technical Solution
For Web applications, the server uses the microblog SDK to complete oauth authentication and API request sending, and returns the execution result to the client. The client completes API selection, API request parameter editing, and sends API requests to the server, returns JSON data.
The server uses Python and bottle + jinja2 + beaker. Weibo SDK uses Weibo. py and applications are deployed on SAES. The client selects Bootstrap + jquery.
JSON data presentation
Displaying the original JSON string is meaningless to developers. The formatted JSON data has a certain indent structure, but it is not convenient to view a large amount of data. Use jsonview. JS library, which can convert JSON data into HTML, color different data types, and fold nested data. When you view a large amount of JSON returned data, you can quickly and conveniently find the desired data segment.
Implementation
Only one is provided. If you are interested, please try it out,CodeHosted on GitHub. Please be correct.
Tool address: http://weiboapidebugger.sinaapp.com
Code hosting: https://github.com/gzb1985/weibo-api-debugger
P.s. Has this idea is in early August, at that time to achieve a demo, after which has been stagnant, middle September surprise found that Weibo official also has a test tool (http://open.weibo.com/tools/console), very useful. Although the API debugging platform has already been repeated, it is still improved and has its own characteristics. Let's explain this idea.