Public
Documentation Settings

Freddy's Artisanal Halloween Candy Shop

The Freddy's Artisanal Halloween Candy Shop API provides a digital interface for accessing the shop's extensive features and data, including user authentication, dashboard analytics, and order management. This API, designed with OpenAPI 3.0.1 specifications, enables developers to seamlessly integrate with Freddy's online platform, facilitating operations like login authentication, token refreshment, dashboard data retrieval, and comprehensive orders handling.

With endpoints meticulously documented for clarity and ease of use, this API is the gateway to automating and enhancing the ecommerce capabilities of Freddy's Artisanal Halloween Candy Shop, making it an essential tool for developers aiming to interact with the shop's system programmatically.

Contact Support:

POSTLogin

https://freddy.codesubmit.io/login

Login endpoint

Use the Login endpoint to generate an access_token and a refresh_token for authorization of other endpoints.

The access_tokens are valid for 15 minutes. You can use the refresh_token (valid for 30 days) generated earlier to renew the access_token. See POST Refresh token for more details.

Note: These are JWT tokens. (JSON web tokens)

 

Generating Access tokens

Enter your username and password in the request body as a JSON object to generate the tokens.

To avoid hassles with wrong credentials, ensure to enter accurate username and password as JSON object. Otherwise, the server will throw an error.

Method: POST

Endpoint: https://freddy.codesubmit.io/login

Request Header: Content_Type:application/json. (login endpoint only accepts application/json)

 

Login_Parameters

 

Login Request Header_parameters

Header nameDescriptionValuesRequired
Content-TypeFormat of the request headerapplication/jsonRequired

 

Login Request Body_parameters

ElementDescriptionTypeRequired
usernameYour usernamestringRequired
passwordYour passwordstringRequired

 

Login Response Body_parameters

ElementDescriptionType
access_tokenGenerated Access tokenstring
refresh_tokenGenerated Refresh tokenstring

 

Login Status Codes

CodeDescriptionAPI Specific description
200OKJSON response object with access and refresh tokens
400BAD REQUESTThe browser (or proxy) sent a request that this server could not understand.
401UNAUTHORIZEDBad Credentials

HEADERS
Content-Type

application/json

Bodyraw (json)
json
{
    "username": "sample_username",
    "password": "sample_password"
}
Example Request
curl
curl --location 'https://freddy.codesubmit.io/login' \
--data '{
    "username": "sampleman",
    "password": "samplepassword"
}'
200 OK
Example Response
json
{
  "access_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE2MjAwMTQ0MDUsIm5iZiI6MTYyMDAxNDQwNSwianRpIjoiOGEyOGJlMjQtY2M3NS00NjQ2LTkwYTYtNTgyOGM0MzhlNDUxIiwiZXhwIjoxNjIwMDE1MzA1LCJpZGVudGl0eSI6ImZyZWRkeSIsImZyZXNoIjpmYWxzZSwidHlwZSI6ImFjY2VzcyJ9.YzeRutCBuY9yingM7v5Ddr9xu9CSPW7BgqAaaoJOUh0",
  "refresh_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE2MjAwMTQ0MDUsIm5iZiI6MTYyMDAxNDAwNSwianRpIjoiOGEyOGJlMjQtY2M3NS00NjQ2LTkwYTYtNTgyOGM0MzhlNDUxIiwiZXhwIjoxNjIwMDE1MzA1LCJpZGVudGl0eSI6ImZyZWRkeSIsImZyZXNoIjpmYWxzZSwidHlwZSI6ImFjY2VzcyJ9.YzeRutCBuY9yingM7v5Ddr9xu9CSPW7BgqAaaoGOUf4"
}
Content-Type

application/json

POSTRefresh Token

https://freddy.codesubmit.io/refresh

Refresh Endpoint

Use the refresh endpoint to request a new access_token using the active refresh_token generated earlier.

The refresh_token, once generated is valid for 30 days

Refreshing the token

To refresh the access_token provide an active refresh_token in the authorization header.

Method: POST

Endpoint: https://freddy.codesubmit.io/refresh

Request Header: Authorization: Bearer <refresh_token>

 

Refresh_Parameters

 

Refresh Request Header_parameters

Header nameDescriptionRequiredValues
BearerRefresh token to receive a new access_tokenRequiredrefresh_token

 

Refresh Response Body_parameters

ElementDescriptionType
access_tokenThe refreshed Access tokenstring

 

Refresh Status Codes

CodeDescriptionAPI Specific
200OKJSON response object with the new access_token
400BAD REQUESTThe browser (or proxy) sent a request that this server could not understand.
401UNAUTHORIZEDToken has Expired
Missing Authorization Header
422UNPROCESSABLE ENTITYNot enough segments
Only refresh tokens are allowed
Signature verification Failed
AUTHORIZATIONBearer Token
Token

<token>

Example Request
curl
curl --location --request POST 'https://freddy.codesubmit.io/refresh' \
--header 'Authorization: Bearer <token>'
200 OK
Example Response
json
{
  "access_token": "eyG9eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE2MjAwMTQ0MDUsIm5iZiI6MTYyMDAxNDQwNSwianRpIjoiOGEyOGJlMjQtY2M3NS00NjQ2LTkwYTYtNTgyOGM0MzhlNDUxIiwiZXhwIjoxNjIwMDE1MzA1LCJpZGVudGl0eSI6ImZyZWRkeSIsImZyZXNoIjpmYWxzZSwidHlwZSI6ImFjY2VzcyJ9.YzeRutCBuY9yingM7v5Ddr9xu9CSPW7BgqAaaoJOUh0"
}
Content-Type

application/json

GETDashboard data

https://freddy.codesubmit.io/dashboard

Dashboard Endpoint

Use the dashboard endpoint to retrieve the entire dashboard data. This includes the data of revenue earned and units sold for the best sellers, sales over a week, and sales over a year.

Retrieving dashboard data

To retrieve the dashboard data, provide the access_token in the authorization header.

Method: GET

Endpoint: https://freddy.codesubmit.io/dashboard

Request Header: Authorization: Bearer <access_token>

Dashboard_Parameters

 

Dashboard Request Header_parameters

Header nameDescriptionRequiredValues
BearerAccess tokenRequiredaccess_token

 

Dashboard Response body_parameters

ElementDescriptionType
dashboardDashboard objectobject
bestsellerArray of bestseller product objectsarray
productProduct details objectobject
idProduct IDstring
imageProduct image URLstring
nameName of the productstring
revenueTotal revenue earned by the productinteger
unitTotal units of the products soldinteger
sales_over_time_weekTotal sales over a week objectobject
dayDay of the weekstring
ordersTotal orders for the dayinteger
totalTotal revenue for the dayinteger
sales_over_time_yearTotal sales over a year objectobject
monthA month in a yearstring
ordersTotal orders for the monthinteger
totalTotal revenue for the monthinteger

 

Dashboard Status Codes

CodeDescriptionAPI Specific description
200OKJSON response object with Dashboard data
400BAD REQUESTThe browser (or proxy) sent a request that this server could not understand.
401UNAUTHORIZEDToken has Expired
422UNPROCESSABLE ENTITYNot enough segments
AUTHORIZATIONBearer Token
Token

<token>

Example Request
curl
curl --location 'https://freddy.codesubmit.io/dashboard' \
--header 'Authorization: Bearer <token>'
200 OK
Example Response
json
{
  "bestseller": [
    {
      "product": {
        "id": "sint",
        "image": "Ut dolor",
        "name": "in ut "
      },
      "revenue": 24656616,
      "units": -42065843
    },
    {
      "product": {
        "id": "dolore aute",
        "image": "Duis pariatur est dolor",
        "name": "mollit Lorem fugia"
      },
      "revenue": -32356412,
      "units": -97142599
    }
  ],
  "sales_over_time_week": {
    "1": {
      "orders": -22614315,
      "total": -39825936
    },
    "2": {
      "orders": 93399884,
      "total": 14962048
    },
    "3": {
      "orders": 14730116,
      "total": 85399531
    },
    "4": {
      "orders": 4507696,
      "total": -74726058
    },
    "5": {
      "orders": -53224025,
      "total": -50805476
    },
    "6": {
      "orders": -95029385,
      "total": -57619666
    },
    "7": {
      "orders": 26346535,
      "total": 20662074
    }
  },
  "sales_over_time_year": {
    "1": {
      "orders": -5953129,
      "total": -35038498
    },
    "2": {
      "orders": -54219977,
      "total": -12954075
    },
    "3": {
      "orders": 58962581,
      "total": 65402151
    },
    "4": {
      "orders": -31324700,
      "total": 41370197
    },
    "5": {
      "orders": -27409951,
      "total": 20238962
    },
    "6": {
      "orders": 72557023,
      "total": -27207379
    },
    "7": {
      "orders": 17834222,
      "total": 64784848
    },
    "8": {
      "orders": 63201673,
      "total": 90943456
    },
    "9": {
      "orders": -1361128,
      "total": 61191142
    },
    "10": {
      "orders": -4353160,
      "total": 34575912
    },
    "11": {
      "orders": 16909063,
      "total": -31972959
    },
    "12": {
      "orders": -84434448,
      "total": 7957504
    }
  }
}
Content-Type

application/json