sf-sequence-api is a RESTful API service written in Go language that utilizes the Gorilla Mux router and PostgreSQL to manage email sequences. This API allows users to create, retrieve, update, and delete email sequences and their corresponding steps.
To run the sf-sequence-api locally, you need to have Go and PostgreSQL installed on your system.
-
Clone the repository:
git clone https://github.com/your-username/sf-sequence-api.git
-
Navigate to the project directory:
cd sf-sequence-api
-
Install dependencies:
go mod tidy
-
Set up your PostgreSQL database and configure the connection details in
config.go
file. -
Run the tests
make test
-
Run the application:
make run
Fetches all sequences from the database.
- Status Code: 200 OK
- Response Body:
[ { "id": 1, "name": "Welcome Sequence", "openTrackingEnabled": true, "clickTrackingEnabled": true, "stepsInterval": 1 }, { "id": 2, "name": "Product Launch Sequence", "openTrackingEnabled": true, "clickTrackingEnabled": true, "stepsInterval": 2 }, ... ]
Fetches a single sequence by its ID.
- sequenceId: The ID of the sequence to fetch.
- Status Code: 200 OK
- Response Body:
{ "id": 1, "name": "Welcome Sequence", "openTrackingEnabled": true, "clickTrackingEnabled": true, "stepsInterval": 1 }
Creates a sequence.
- Name (string): The name of the sequence.
- OpenTrackingEnabled (boolean): Indicates whether open tracking is enabled for the sequence.
- ClickTrackingEnabled (boolean): Indicates whether click tracking is enabled for the sequence.
- StepsInterval (integer): The interval between each step in the sequence.
{
"name": "Abandoned Cart Sequence",
"openTrackingEnabled": true,
"clickTrackingEnabled": true,
"stepsInterval": 3
}
- Status Code: 201 Created
- Response Body:
{ "id": 3, "name": "Abandoned Cart Sequence", "openTrackingEnabled": true, "clickTrackingEnabled": true, "stepsInterval": 3 }
Creates a step.
- sequenceId (string): The id of the sequence the step belongs to.
- emailSubject (string): The subject of the email
- emailContent (string): The content of the email
{
"sequenceId": "d934f39e-6d40-406f-8b75-dcea99e4e5c1",
"emailSubject": "Test Subject One",
"emailContent": "Test Content One"
}
- Status Code: 201 Created
- Response Body:
{ "id": 3 }
Updates a step.
- id (string): The id of the step.
- emailSubject (string): The value to update with
- emailContent (string): The value to update with
{
"id": "4f6e9fb9-af39-4199-91ec-f9606b4af790",
"emailSubject": "Updated Subject",
"emailContent": "Updated content"
}
- Status Code: 200 OK
- Response Body:
{ "id": "4f6e9fb9-af39-4199-91ec-f9606b4af790" }
Deletes a step by its ID
- stepId: The ID of the step to delete.
- Status Code: 200 OK
- Your Name adrian.tomov@live.com
This project is licensed under the MIT License - see the LICENSE file for details.