Skip to content

Instantly share code, notes, and snippets.

@DashBarkHuss
Last active March 21, 2021 15:37
Show Gist options
  • Save DashBarkHuss/fa0340533ecf84c3f0ac6156246f1b6f to your computer and use it in GitHub Desktop.
Save DashBarkHuss/fa0340533ecf84c3f0ac6156246f1b6f to your computer and use it in GitHub Desktop.
API contract example

Order Object

  • Order object
{
_id: string,
  gifts: [
    {
      // gift object
      item: {
        _id: string,
        itemName: string,
        price: integer,
        url: string,
        currency: string,
        wishlist: string,
        itemImage: string,
      },
      qty: integer,
      totalPrice: integer,
    },
    {<gift_object>},
    {<gift_object>}
  ],
  alias: {
    _id: string,
    handle: string,
    aliasName: string,
    currency: string,
    handle_lowercased: string,
  },
  tender: {
    amount: integer,
    currency: string,
    converted: null || {
      amount: integer,
      currency: string,
    },
  },
  noteFromGifter: {
    message: string,
    read: null || datetime,
  },
  fromLine: string,
  thankYouNote: null || {
    message: string,
    dateSent:datetime(iso 8601)
  },
  paidOn: datetime(iso 8601),
};


GET /api/orders/:aliasId

Returns all paid gift orders gifted to specified alias.

  • URL Params
    Required: aliasId=[integer]

  • Data Params
    None

  • Headers
    Authentication: Cookie <session_cookie>

  • Success Response:

    • Code: 200
      Content:
    [
       {<order_object>},
       {<order_object>},
       {<order_object>}
    ]
    
  • Error Response:
    • Code: 401
      Content: { error : "You are unauthorized to make this request" }
Successful Response Example:
[
  {
    _id: '603a9b8bbf6c85032169fe80',
     gifts: [
      {
        item: {
          _id: '603a8e00bf6c85032169fe7e',
          itemName: 'Gucci Ken Scott Print Hooded Jacket - Farfetch',
          price: 210000,
          url:'https://www.farfetch.com/shopping/women/gucci-ken-scott-print-hooded-jacket-item-16331626.aspx?storeid=10644',
          currency: 'USD',
          wishlist: '603a8d02bf6c85032169fe7d',
          itemImage: '/data/images/itemImages/ca1c1ba8-44df-4b0a-8b65-486e2a346f0f.png',
        },
        qty: 1,
        price: 210000,
      },
    ],
    alias: {
      _id: '603a8d02bf6c85032169fe7c',
      handle: 'dadasheshe1',
      aliasName: 'KULLi',
      currency: 'USD',
      handle_lowercased: 'dadasheshe1',
    },
    tender: {
      amount: 210000,
      currency: 'USD',
      converted: null,
    },
    noteToWisher: {
      message: "Hey, you're a huge inspiration for me. This gift is to show my gratitude.",
      read: '2020-02-28T14:42:11.394Z',
    },
    fromLine: 'Fred',
    thankYouNote:{
      message: "Thank you Fred for these awesome gifts!",
      dateSent: '2020-02-28T14:50:11.394Z'
    },
    paidOn: '2020-02-26T14:42:11.394Z',
  },
];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment