Skip to content

Instantly share code, notes, and snippets.

@1a8e
Last active January 23, 2019 10:13
Show Gist options
  • Save 1a8e/69f8aa940210ec80f33c528273deaa85 to your computer and use it in GitHub Desktop.
Save 1a8e/69f8aa940210ec80f33c528273deaa85 to your computer and use it in GitHub Desktop.
Documentation for the real-time KFC menu sync API

Tech Documentation for API to update the KFC menu items for the provided store_id on-demand.

  • API Schematics

    • REQUEST METHOD: POST

    • REQUEST URL: BASE_HAPTIK_URL + /integration/update_kfc_store_menu/

    • REQUEST HEADERS:

      • Authorization uses BasicAuth.
      • username and password will be shared with you separately.
      {
          "Authorization": "Bearer <TOKEN>",
          "Content-Type": "application/json"
      }
    • REQUEST PAYLOAD:

      • store_id should be an integer value greater than 0
      {
          "store_id": 133
      }
    • RESPONSE:

      • Status Code: 200
      • Response:
      {
          "response": "The menu for the store_id = 133 was updated successfully!"
      }
    • SAMPLE CURL COMMAND:

      curl -X POST \
          BASE_HAPTIK_URL + /integration/update_kfc_store_menu/ \
        -H 'Authorization: Bearer <TOKEN>' \
        -H 'Content-Type: application/json' \
        -d '{"store_id": 133}'
  • Error Scenarios

    • WRONG AUTH TOKEN:

      • Status Code: 401
      • Resolution:
        • Try checking the Authorization Token you have used.
        • Please refer the section on API Schematics.
      • Response:
      {
          "error": "invalid Authorization",
          "response": null
      }
    • WRONG STORE ID:

      • Status Code: 400
      • Resolution:
        • Try checking the format of the request.
        • Please refer the section on API Schematics.
      • Response:
      {
          "error": "invalid request",
          "response": null
      }
    • MENU API FAILED:

      • Status Code: 502
      • Resolution:
        • Please ensure that the KFC's Menu API is functional.
        • Else, call Haptik.
      • Response:
      {
          "error": "kfc menu api failed",
          "response": "<JSON DUMPS OF MENU API RESPONSE FOR NOT 200 CASES>"
      }
    • MENU API TIMED OUT:

      • Status Code: 504
      • Resolution:
        • Please ensure that the KFC's Menu API is functional.
        • Else, call Haptik.
      • Response:
      {
          "error": "kfc menu api timed out",
          "response": null
      }
    • DB INTEGRITY ERROR:

      • Status Code: 503
      • Resolution:
        • Please try the request again.
        • Else, call Haptik.
      • Response:
      {
          "error": "saving in the db failed",
          "response": null
      }
    • CACHE CLEARING ERROR:

      • Status Code: 503
      • Resolution:
        • Please try the request again.
        • Else, call Haptik.
      • Response:
      {
          "error": "saving the cache failed",
          "response": null
      }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment