Git Product home page Git Product logo

likeness-api's Introduction

Likeness API v1 Documentation

Welcome to the Likeness API v1 documentation. Likeness API allows you to compare the similarity between two texts. To use this API, you need to sign in with your Google or GitHub account, generate an API key, and include it in the headers of your requests. This API is built using Next.js, TypeScript, Tailwind CSS, Clerk, Redux, MongoDB, Prisma.

Table of Contents

  1. Authentication
  2. Endpoint
  3. Request
  4. Response
  5. Example
  6. Error Codes

Authentication

Google Login

To use the Likeness API, you can sign in with your Google account. This authentication process ensures that your access to the API is secure.

GitHub Login

Alternatively, you can also sign in with your GitHub account to access the API.

Generating an API Key

After successfully signing in with either Google or GitHub, you can generate an API key. This API key is required to make requests to the API.

Revoking an API Key

If you wish to revoke an API key for security reasons or any other purpose, you can do so from your Likeness API account settings.

Endpoint

POST /api/v1/likeness

This endpoint is used to compare the similarity between two text strings. You need to include the following parameters in the request body:

  • text1: The first text string for comparison.
  • text2: The second text string for comparison.

Request Headers

To authenticate your request, include your API key in the headers of your request.

Authorization: YOUR_API_KEY

Request Body

{
  "text1": "This is the first text for comparison.",
  "text2": "This is the second text for comparison."
}

Response

Upon making a valid request, the Likeness API will respond with a status code and a JSON object containing the similarity score. The similarity score is a floating-point number between 0 and 1, where 0 indicates no similarity, and 1 indicates identical text.

Successful Response

  • HTTP Status Code: 200
{
  "message": "Success",
  "likeness": 0.7
}

Example

Here's an example of how to use the Likeness API to compare two text strings using JavaScript:

import axios from 'axios';

const options = {
  method: 'POST',
  url: 'https://likeness-api.vercel.app/api/v1/likeness',
  data: {
    text1: 'First text',
    text2: 'Second text',
  },
  headers: {
    Authorization: 'YOUR_API_KEY',
  },
};

try {
  const response = await axios.request(options);
  console.log(response.data);
} catch (error) {
  console.error(error);
}

Make sure to replace 'YOUR_API_KEY' with your actual API key.

Error Codes

The Likeness API may return the following error codes:

  • HTTP Status Code: 400
{
  "message": "Bad Request. Missing a required parameter"
}
  • HTTP Status Code: 401
{
  "message": "Unauthorized. Missing API Key"
}
  • HTTP Status Code: 403
{
  "message": "Forbidden"
}

That's it! You should now have all the information you need to use the Likeness API v1. If you have any further questions or encounter any issues, feel free to reach out to our support team.

likeness-api's People

Contributors

biplo12 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.