Code Monkey home page Code Monkey logo

kptncook-api-reverse-engineering's Introduction

kptncook-api-reverse-engineering

I got this HTTP-API documentation by reversing the kptncook app and analysing its traffic.
Check out https://medium.com/analytics-vidhya/reversing-and-analyzing-the-cooking-app-kptncook-my-recipe-collection-5b5b04e5a085 for a guide on how to get started with the kpntcook app.

The API is accessible under https://mobile.kptncook.com

Optaining API key

Each call to the api (aswell as calls to get objects such as recipe images from cloudfront) have to include a http param called kptnkey. This kptnkey is hardcoded in the app and doesn't seem to change.

I'm not sure what the implications of providing such an API key are so I won't provide it here. You can easily get it by analyzing the app in android-studio or just by searching kptnkey on github.

Then just append this key to each call like this: https://mobile.kptncook.com/<ressource_id>/?kptnkey=6*****y-o**k-I*****J-j****6

Login

Logs user in and returns user info, the user's access token, name and the user's favorite recipe's ids.

  • kptnkey required:
    No
  • URL:
    /login/userpass
  • Method:
    POST
  • Request Body:
    type: json
    example:
    {
        "email": "<account_address>",
        "password": "<cleartext_password>"
    }
  • Request Answer:
    example:
    {
        "accessToken": "1*****5-8**3-4**1-5**b-e*********d",
        "name": "<realname>",
        "favspace": 35,
        "favorites": [
            "5dcbd5cc5400009587b05515",
            ...
        ],
        "inviteCode": "4****4"
    }

Favorites

Gets all favorites of the logged in user and returns their IDs as a list

  • kptnkey required:
    No
  • URL:
    /favorites
  • Method:
    GET
  • Request Headers:
    Token: insert the accessToken returned when logging in here
    example: Token: 1*****5-8**3-4**1-5**b-e*********d
  • Request Answer:
    example:
    {
        "favspace": 35,
        "favorites": [
            "52c5e4021d46335f01572524",
            ...
        ]
    }

Search

Returns one recipe by its id. You can search by a recipe's uid or identifier:

  • Possible ids:
    • uid: Is the id which can be extracted from share links
      e.g. http://mobile.kptncook.com/recipe/pinterest/Low-Carb-Tarte-Flamb%C3%A9e-with-Serrano-Ham-%26-Cream-Cheese/315c3c32)
      The 315c3c32 part at the end is the uid
    • identifier: Is the internal id which is returned by the other api functions in the $oid field
  • kptnkey required:
    Yes
  • URL:
    /recipes/search
  • Method:
    POST
  • Request Parameters:
    • kptnkey
      example: ?kptnkey=6*****y-o**k-I*****J-j****6
    • lang
      possible values: en, de, fr, pt, es note: When using the lang parameter the api response switches to a different (new) format.
  • Request Body:
    type: json
    example:
    [
        {
            "uid": "315c3c32"
        }
    ]
    or
    [
        {
            "identifier": "59b68c8d2c00000b0535125a"
        }
    ]
  • Full Request Example:
    curl --location --request POST 'https://mobile.kptncook.com/recipes/search?kptnkey=6*****y-o**k-I*****J-j****6' \
    --header 'Token: 1*****5-8**3-4**1-5**b-e*********d' \
    --header 'Content-Type: application/json' \
    --data-raw '[
            {
                "uid": "315c3c32"
            }
            ]
    '
  • Request Answer:
    example (old):
    [
        {
            "_id": {
                "$oid": "59b68c8d2c00000b0535125a"
            },
            "localizedTitle": {
                ...
                "en": "Low Carb Tarte Flambée with Serrano Ham & Cream Cheese",
                ...
            },
            ...
        },
        ...
    ]
    example (new with lang set):
    [
        {
            "_id": {
                "$oid": "59b68c8d2c00000b0535125a"
            },
            "title": "Low Carb Tarte Flambée with Serrano Ham & Cream Cheese",
            "rtype": "Pork",
            "gdocs": "1046",
            "authorComment": "Flourless but so delicious!",
            "uid": "315c3c32",
            ...
        },
        ...
    ]

Daily Favorites (Superseeded by a new endpoint)

Returns the 3 daily featured recipes in full detail

  • kptnkey required:
    Yes
  • URL:
    /reciped/de/<unix_timestamp>
    The timestamp doesn't actually matter, it always returns the 3 current recipes
    (a value of 1 can also be used)
  • Method:
    GET
  • Request Parameters:
    kptnkey
    example: ?kptnkey=6*****y-o**k-I*****J-j****6
  • Request Answer:
    example:
    [
        {
            "_id": {
                "$oid": "60b0c1323c000035008250c9"
            },
            "localizedTitle": {
                ...
                "en": "Cheesy Chicken Bake with Garlic Croutons",
                ...
            },
            ...
        },
        ...
    ]

kptncook-api-reverse-engineering's People

Stargazers

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