.NET MAUI, REST APIs, Android and Fiddler: Insights on the use of Fiddler
How to configure development environment to use fiddler to monitor only the traffic from your android emulator and use fiddler to develop a deeper understanding of the API’s you are using.
Fiddler a network traffic monitoring tool that comes in two versions: Classic (free and no longer supported) and Everywhere (paid, with more features) has become an everyday tool for my mobile development.
Building a mobile app with .NET Maui and REST API’s, it has helped me bridge the gap on API documentation and provide a view in to how the app is actually using the API’s.
My mobile app uses OpenLibrary.org which is an open-source project offering a set of web APIs to access their extensive library of books and artifacts. While the OpenLibrary team provides solid documentation, it can be somewhat sparse. To bridge these gaps, I’ll demonstrate how to use Fiddler alongside a .NET MAUI app to better understand and integrate with these REST APIs.
The application in question is a .NET MAUI mobile app designed to run on both Android and iOS. To monitor the REST API calls while the app is running, you need to set up Fiddler correctly on your Android device or emulator. Fiddler provides excellent documentation for this setup, which you can find here1. You will likely also want to configure fiddler to monitor the traffic from the web app hosted by the provider to help understand the API’s they are using and how they use them for a deeper understanding of what is available.
After following the basic fiddler instrutions above I made some additional configurations:
The following instructions from Bing Copilot is what I used to configure fiddler for an Android emulator. It’s almost identical to the link above from fiddler documentation along with some additional configurations I made:
{“event_type”:2,”year”:2018,”month”:5,”day”:18,”event_id”:null}
POST https://openlibrary.org/works/OL20643179W/check-ins HTTP/1.1
Content-Type: application/json; charset=utf-8
Cookie: pd=; session=/people/mynextbook%2C2024-09-06T14%3A56%3A52%2C04338%248a8ba7b97c5c121f24604a0332e40cc1
User-Agent: Dalvik/2.1.0 (Linux; U; Android 15; sdk_gphone64_x86_64 Build/AP31.240517.022)
Host: openlibrary.org
Connection: Keep-Alive
Accept-Encoding: gzip
Content-Length: 124
“{\u0022event_type\u0022: 2, \u0022year\u0022: 2018, \u0022month\u0022: 5, \u0022day\u0022: 18, \u0022event_id\u0022: null}”
Hope this provides some insight on how to utilize fiddler to help fill in the gaps on web apps you are integrating with and how you can troubleshoot your own apps by tracking exactly what api’s are being called and what they look like.
This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)