Code Monkey home page Code Monkey logo

simple_go_api's Introduction

Simple Go API

An API for managing users' marketing segments

Table of Contents

Features

  • Add, delete, and reassign segments
  • Retrieve users' segments
  • Generate user history reports
  • Easy-to-use JSON API

Getting Started

To get started with the Avito Go API, follow these steps:

  1. Clone this repository: git clone https://github.com/yourusername/avito-go-api.git
  2. Run docker compose up
  3. Access the API at http://localhost:8080 in docker interface.

API Endpoints

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

Usage Examples

Adding a Segment

To add a new segment, send a POST request to the following endpoint:

curl -X POST http://localhost:8080/ -d '{"name": "NewSegment"}'

Deleting a Segment

To delete a segment, send a DELETE request to the following endpoint:

curl -X DELETE http://localhost:8080/ -d '{"name": "SegmentToDelete"}'

Getting User's Segments

To retrieve segments, send a GET request to the following endpoint:

curl -X GET http://localhost:8080/ -d '{"userId": 1}'

Reassigning User's Segments

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
}

Getting User History

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
}

Downloading Latest User History

To download latest history report file , send a GET request to:

curl http://localhost:8080/report

simple_go_api's People

Contributors

x-wheel-of-fortune avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.