To manually enumerate API method parameters using a web browser's developer tools, follow these steps:
Steps to Enumerate API Method Parameters:
1. Open Developer Tools:
In your web browser, press F12 or right-click on the page and select Inspect. Navigate to the Network tab to monitor API requests and responses.
2. Trigger API Requests:
Interact with the web application to generate API requests. For example, clicking buttons, filling forms, or navigating through the app will send various API requests.
3. Analyze Request Details:
Select individual requests in the Network tab to review their details, including:
- Request URL: Look for query string parameters (e.g., ?key=value) and path parameters (e.g., /users/{id}).
- Headers: Check for authorization tokens, content types, or any other custom headers.
- Request Body: If the request is a POST, PUT, or PATCH method, examine the payload in the request body to identify parameters.
4. Modify Parameters:
Use the Headers or Params section of the developer tools to modify values directly and re-send the request to observe the API's response behavior.
5. Study API Responses:
Review responses for hints about valid parameters, error messages indicating required or invalid parameters, or unexpected behavior.
6. Inspect JavaScript Code:
In the Sources tab, review JavaScript files for hardcoded endpoints or parameter lists.
7. Utilize Console:
Test endpoints using JavaScript in the browser's console. For instance:
fetch('https://api.example.com/endpoint?param=value')
.then(response => response.json())
.then(data => console.log(data));
Headers and Responses to Focus On
- Authorization Headers: Often required to access APIs.
- Error Messages: May reveal additional parameters or expected data formats.
- Custom Headers: Provide context about API usage.
- Status Codes: Help identify whether the request was successful (e.g., 200) or failed due to missing parameters (e.g., 400).