Structure
Understanding the Ping Proxies API structure, URL patterns, HTTP methods, and data formats
The Ping Proxies API follows RESTful principles with consistent URL patterns, standard HTTP methods, and JSON-formatted requests and responses. This page explains the core structural components of the API.
Base URL
All API requests should be made to the following base URL:
URL Structure
The API URLs follow a consistent pattern:
Components
Component | Description | Examples |
---|---|---|
version | API version | 1.0 |
scope | Access level | public , private |
resource | The resource type | proxy , service , proxy_user |
action | Operation to perform | retrieve , search , create , edit |
identifier | Resource ID (when applicable) | {proxy_id} , {service_id} |
All Public API therefore follow this URL format:
Example URLs
HTTP Methods
The API uses standard HTTP methods to perform different actions:
Method | Description | Example Usage |
---|---|---|
GET | Retrieve data | Fetch a proxy, list services, search resources |
POST | Create data | Create a new proxy user, generate a checkout |
PATCH | Update data | Edit a proxy user, update service metadata |
DELETE | Remove data | Cancel a service, delete a proxy user |
Inconsistent HTTP Method: The route POST /public/user/proxy/list_by_id
violates the established HTTP method convention.
According to the convention, retrieval operations should use the GET method, but this endpoint uses POST for a retrieval operation. This is an intentional deviation to support sending large lists of UUIDs in the request body, which wouldn’t be practical with query parameters in a GET request.
Method and URL Mapping
The HTTP method and URL structure work together to define the operation:
Operation | HTTP Method | URL Pattern | Example |
---|---|---|---|
List/Search | GET | /resource/search | GET /proxy/search |
Retrieve | GET | /resource/retrieve/{id} | GET /proxy/retrieve/123 |
Create | POST | /resource/create | POST /proxy_user/create |
Update | PATCH | /resource/edit/{id} | PATCH /proxy/edit/123 |
Delete | DELETE | /resource/delete/{id} or /resource/cancel/{id} | DELETE /proxy_user/delete/123 |
Request Format
Headers
All requests should include the following headers:
Header | Description | Required |
---|---|---|
X-API-Public-Key | Your public API key | Yes |
X-API-Private-Key | Your private API key | Yes |
Content-Type | application/json for requests with a body | For POST/PATCH |
Request Body
For POST
and PATCH
requests, data should be sent as JSON in the request body:
Query Parameters
For GET
requests, parameters are passed in the URL query string:
Common query parameters include:
Parameter | Description | Example |
---|---|---|
page | Page number for pagination | page=2 |
per_page | Items per page | per_page=50 |
sort_by | Field to sort by with optional direction | sort_by=creation_datetime_desc |
Response Format
All API responses are JSON objects with a consistent structure:
Success Responses
Successful responses include:
- HTTP status code in the 200 range
data
field containing the requested resource(s)message
field with a success message
Example of a successful retrieve operation:
Example of a successful search operation:
Error Responses
Error responses include:
- HTTP status code in the 400 or 500 range
error
field with the error typemessage
field with a description of the errorapi_request_id
field for reference when contacting support
Example error response:
HTTP Status Codes
The API uses standard HTTP status codes to indicate the result of a request:
Code | Description | Common Scenarios |
---|---|---|
200 | OK | Successful GET, PATCH operations |
201 | Created | Successful POST operation |
400 | Bad Request | Invalid parameters or data |
401 | Unauthorized | Invalid or missing authentication |
403 | Forbidden | Insufficient permissions |
404 | Not Found | Resource doesn’t exist |
409 | Conflict | Resource already exists |
422 | Unprocessable Entity | Valid request but operation failed due to business logic |
500 | Internal Server Error | Server-side error |
Data Types
The API uses standard JSON data types:
Type | JSON Representation | Example |
---|---|---|
String | "text" | "proxy_type": "datacenter" |
Number | 123 or 123.45 | "proxy_http_port": 8080 |
Boolean | true or false | "proxy_user_is_strict_security": true |
Object | { "key": "value" } | "proxy_user_metadata": { "department": "Marketing" } |
Array | [ value1, value2 ] | "restricted_service_ids": ["123-456", "789-012"] |
Null | null | "service_promotional_code": null |
Datetime | 2023-09-15 00:00:00 | "service_creation_datetime": "2023-09-15 00:00:00" |
Date and Time Format
All date and time values in the API use the format below:
Example: "2023-09-15 14:30:00"
When filtering by dates, you can use:
- Format:
2023-09-15 14:30:00
- Date only:
2023-09-15