An API for managing users' marketing segments
- Add, delete, and reassign segments
- Retrieve users' segments
- Generate user history reports
- Easy-to-use JSON API
To get started with the Avito Go API, follow these steps:
- Clone this repository:
git clone https://github.com/yourusername/avito-go-api.git
- Run
docker compose up
- Access the API at
http://localhost:8080
in docker interface.
Endpoint | Description |
---|---|
POST / |
Add a new segment |
DELETE / |
Delete a segment |
PUT / |
Reassign user's segments |
GET / |
Get user's segments |
GET /get_history |
Generate a user history file |
GET /report |
Download latest history file |
To add a new segment, send a POST request to the following endpoint:
curl -X POST http://localhost:8080/ -d '{"name": "NewSegment"}'
To delete a segment, send a DELETE request to the following endpoint:
curl -X DELETE http://localhost:8080/ -d '{"name": "SegmentToDelete"}'
To retrieve segments, send a GET request to the following endpoint:
curl -X GET http://localhost:8080/ -d '{"userId": 1}'
To reassign segments, send a PUT request to the following endpoint:
curl -X PUT http://localhost:8080/ -d
{
"segmentsToAdd": ["Segment1", "Segment2"],
"segmentsToRemove": ["Segment3"],
"userId": 123
}
To update history report file to a user's history, send a GET request to:
curl -X GET http://localhost:8080/get_history -d
{
"userId": 1,
"year": 2023,
"month": 8
}
To download latest history report file , send a GET request to:
curl http://localhost:8080/report