Go Back
Outages Upload Endpoint
POST
/api/v0/outages
This endpoint allows you to upload outages data files to the Ravenwits system. The endpoint accepts CSV files containing outages information and processes them for analysis.
Parameters
| Parameter |
Type |
Required |
Description |
| token |
String |
Yes |
Your API authentication token. This token identifies your account and authorizes the upload request. |
| file |
File |
Yes |
The CSV file containing outages data. Must be a valid CSV format with appropriate headers. |
Request Format
The request must be sent as multipart/form-data with the following fields:
Content-Type: multipart/form-data
token: your_api_token_here
file: [CSV file data]
Response Format
Success Response (200 OK)
{
"message": "File successfully uploaded",
}
Error Responses
Authentication Error (401 Unauthorized)
{
"error": "Invalid or missing token"
}
Validation Error (400 Bad Request)
{
"error": "Invalid file format or missing required fields"
}
File Format Requirements
The uploaded CSV file should contain the following information:
- Format: CSV (Comma-Separated Values)
- Encoding: UTF-8 recommended
- Headers: First row should contain column headers
- Data: Each subsequent row represents an outage record
Example Usage
Here's an example of how to use this endpoint with curl:
curl -X POST \
-H "Content-Type: multipart/form-data" \
-F "token=your_api_token_here" \
-F "file=@outages_data.csv" \
https://api.ravenwits.com/api/v0/outages
Testing
For testing purposes, you can use the testing token which will simulate the upload process without actually processing the file. The response will indicate that a testing token was used.
{
"message": "File successfully sent using Testing-Token. In case you intended to effectively upload the file, please use a regular token",
}