Sonia

Sonia · Acciones GPT

User Information API

API to retrieve user information

  • GET /informationGet User Information

    Retrieve user information in JSON format

  • GET /scheduleRetrieve User Schedule

    Retrives the schedule of the user, including appointments. It accepts a time windows as well. By default it retrieves the appointements of the next seven days

  • POST /scheduleCreate an Event

    Create a new event in the calendar

  • DELETE /schedule/{event_id}Delete an Event from the event id

    Delete an event from the calendar using the event id

Esquema original API
{
  "openapi": "3.1.0",
  "info": {
    "version": "1.0.0",
    "title": "User Information API",
    "description": "API to retrieve user information"
  },
  "servers": [
    {
      "url": "https://sonia.redbeardlab.com",
      "description": "Production server"
    }
  ],
  "paths": {
    "/information": {
      "get": {
        "summary": "Get User Information",
        "description": "Retrieve user information in JSON format",
        "operationId": "retrieve_user_information",
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string",
                        "description": "The user id"
                      },
                      "linking_urk": {
                        "type": "string",
                        "description": "The URL to use if the user ask to link a calendar"
                      },
                      "integrations": {
                        "type": "array",
                        "description": "The integration already set up by the user",
                        "items": {
                          "type": "string"
                        }
                      }
                    }
                  }
                },
                "example": {
                  "id": "abc",
                  "linking_url": "https://sonia.redbeardlab.com/link/1",
                  "integrations": [
                    "google"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized. Authentication required."
          },
          "500": {
            "description": "Internal Server Error"
          }
        }
      }
    },
    "/schedule": {
      "get": {
        "summary": "Retrieve User Schedule",
        "description": "Retrives the schedule of the user, including appointments. It accepts a time windows as well. By default it retrieves the appointements of the next seven days",
        "operationId": "retrieve_user_schedule",
        "parameters": [
          {
            "name": "start_time",
            "in": "query",
            "required": false,
            "description": "The time from when to start to search for the events. Expressed in Linux Epoch value.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "end_time",
            "in": "query",
            "required": false,
            "description": "The time from when to end to search for the events. Expressed in Linux Epoch value.",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The user schedule and events for the required period",
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string",
                        "description": "The event ID - The unique identifier of the event, use this to refer to this event for example for deletion"
                      },
                      "title": {
                        "type": "string",
                        "description": "Title of the event"
                      },
                      "description": {
                        "type": "string",
                        "description": "Description of the event"
                      },
                      "start_time": {
                        "type": "string",
                        "format": "date-time",
                        "description": "Start time of the event in ISO 8601 format"
                      },
                      "end_time": {
                        "type": "string",
                        "format": "date-time",
                        "description": "End time of the event in ISO 8601 format"
                      }
                    },
                    "required": [
                      "title",
                      "start_time",
                      "end_time"
                    ]
                  }
                },
                "examples": {
                  "EventListExample": {
                    "value": [
                      {
                        "title": "Meeting with Client",
                        "description": "Discuss project details",
                        "start_time": "2023-01-15T10:00:00Z",
                        "end_time": "2023-01-15T11:00:00Z"
                      },
                      {
                        "title": "Team Standup",
                        "description": "Daily team meeting",
                        "start_time": "2023-01-16T09:30:00Z",
                        "end_time": "2023-01-16T10:00:00Z"
                      }
                    ]
                  }
                }
              }
            }
          }
        }
      },
      "post": {
        "summary": "Create an Event",
        "description": "Create a new event in the calendar",
        "operationId": "new_event",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "start_time": {
                    "type": "integer",
                    "description": "Start time of the event in unix epoch"
                  },
                  "end_time": {
                    "type": "integer",
                    "description": "End time of the event in unix epoch"
                  },
                  "title": {
                    "type": "string",
                    "description": "Title of the event"
                  },
                  "description": {
                    "type": "string",
                    "description": "Description of the event"
                  },
                  "attendees": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "format": "email"
                    },
                    "description": "List of attendees' email addresses. Only email address are accepted."
                  }
                },
                "required": [
                  "startTime",
                  "endTime",
                  "title",
                  "attendees"
                ]
              },
              "example": {
                "startTime": "2023-11-30T10:00:00Z",
                "endTime": "2023-11-30T11:00:00Z",
                "title": "Team Meeting",
                "description": "Weekly team meeting to discuss project status",
                "attendees": [
                  "john@example.com",
                  "jane@example.com"
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Event created successfully",
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "type": "object",
                    "properties": {
                      "link": {
                        "type": "string",
                        "description": "An absolute link to this event in the Google Calendar Web UI."
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad request. Check your input data.",
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "type": "object",
                    "properties": {
                      "error": {
                        "type": "object",
                        "properties": {
                          "message": {
                            "type": "string",
                            "description": "What went wrong with the request to communicate with the user"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "Internal server error. Something went wrong."
          }
        }
      }
    },
    "/schedule/{event_id}": {
      "delete": {
        "summary": "Delete an Event from the event id",
        "description": "Delete an event from the calendar using the event id",
        "operationId": "delete_event",
        "parameters": [
          {
            "name": "event_id",
            "in": "path",
            "required": true,
            "description": "The unique identifier of the event to be deleted",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Event successfully deleted"
          },
          "401": {
            "description": "Unauthorized. Authentication required."
          },
          "404": {
            "description": "Event not found"
          },
          "500": {
            "description": "Internal Server Error"
          }
        }
      }
    }
  }
}