Automated tool to extract and test API endpoints from Global Payments developer documentation.
-
Automated Extraction: Scrapes API documentation using Playwright
- Extracts code snippets in multiple languages (JSON, cURL)
- Captures request structure (URL, headers, body)
- Extracts documented HTTP status codes
- Handles multi-tab JSON structure (URL & QUERY, HEADERS, BODY)
- Single-block extraction for cURL commands
-
Live API Testing: Tests extracted endpoints against the actual API
- Generates fresh OAuth 2.0 tokens
- Tests multiple HTTP status code scenarios
- Validates response structure and format
- Records test results with timestamps
-
Web Dashboard: Interactive UI to view results
- View extracted API data
- Display code snippets with syntax highlighting
- Compare documented vs actual responses
- Load historical test results
- Clone the repository:
git clone https://github.com/MonroeKA/GP_API_Validator.git
cd GP_API_Validator- Install dependencies:
npm install- Install Playwright browsers:
npx playwright install firefox- Create
.envfile from the example:
cp .env.example .env- Edit
.envand add your Global Payments API credentials:
GP_API_APP_ID=your_app_id_here
GP_API_APP_KEY=your_app_key_here
Get your credentials from the Global Payments Developer Portal
- Start the server:
node server.js- Open the dashboard:
http://localhost:3000
-
Enter a Global Payments API documentation URL and choose your options:
✓ Run live API test after extraction
✓ Save extraction results to file
- Extract - Run with the above options
https://developer.globalpayments.com/api/accounts#/Retrieve%20a%20List%20of%20Accounts/retrieveAListOfAccountshttps://developer.globalpayments.com/api/links#/Create%20a%20link/post-links
- Express server on port 3000
- Playwright-based web scraper (Firefox headless)
- OAuth 2.0 token generation with SHA512 secrets
- Live API testing with scenario coverage
- Interactive dashboard with tabbed interface
- Syntax highlighting for code snippets
- Real-time extraction status
- Historical results browser
- Navigate to documentation page
- Detect available languages (JSON, cURL)
- For each language:
- Switch language if needed (2s wait for UI update)
- JSON: Extract from 3 tabs (URL & QUERY, HEADERS, BODY)
- cURL: Extract single complete command
- Extract documented HTTP status codes
- Parse endpoint metadata (method, URL, headers)
-
POST /api/extract- Extract and optionally test an API endpoint{ "url": "https://developer.globalpayments.com/api/...", "runLiveTest": true } -
GET /api/health- Health check -
GET /api/list-results- List saved extraction results -
GET /api/load-result/:filename- Load a specific result file
extraction-results-{timestamp}.json- Complete extraction and test datagp-access-token.json- Generated OAuth 2.0 access token (auto-refreshed)
.env file or any files containing API credentials. These files are excluded in .gitignore.
MIT License - see LICENSE file for details.
Contributions are welcome! Please feel free to submit a Pull Request.
gp-access-token.json- Current OAuth token (auto-generated)
.env- API credentials (gitignored)config/credentials.json- Alternative credentials storage (gitignored)
express- Web server frameworkplaywright- Browser automation for scraping- Node.js 18+ (native fetch support)
- Finds dropdown with class
request-switcher - Extracts available languages from dropdown menu items
- Case-insensitive matching (handles "cURL" vs "curl")
- JSON uses container
.api-explorer__try-it__jsonwith sub-tabs - cURL uses container
.api-explorer__try-it__curlwith single code block - Waits 2 seconds after language switch for DOM update
- Uses OAuth 2.0 client credentials flow
- Secret = SHA512(nonce + appKey)
- Tokens valid for ~24 hours
- Auto-refreshes on each test run
"No code content found"
- Increase wait times in language switching (line ~448)
- Check if page structure has changed
Token generation fails
- Verify
.envcredentials are correct - Check network connection to sandbox environment
Page load timeout
- Page uses multiple fallback strategies
- Partial extraction attempted on timeout
MIT