SwagUp API: How to get products and prices from SwagUp Catalog

Get products from the catalog

To get your order request ready you need to know the products available in the SwagUp catalog. These products are grouped into categories, and each category has a list of items which are all the products that belong to that category. You can also dynamically get prices based on quantities and the number of colors on your design.

 

To obtain the list of products available in the catalog, you can make a GET request to:

 

https://api.swagup.com/form-api/v1/categories/

 

Example response*:

{
 "count": 2,
 "next": null,
 "previous": null,
"results": [
  {
     "id": 32,
     "CatName": "Packaging",
     "icon": "https://swagup-static.swagup.com/platform/media/form/packaging.svg",
     "iconActive": "https://swagup-static.swagup.com/platform/media/form/packaging-blue.svg",
    "items": [
      {
         "id": 329,
    "salesforce_id":"01t5A000007y53qQAA"
         "name": "Plain Mailer Boxes",
         "description": "Send you swag in style with this sleek, white, tab-locking mailer box. \r\n\r\nItem Details:\r\n- 13\" x 10\" x 4\"",
         "img":
"https://swagup-static.swagup.com/platform/media/form/products/01t5A000007y53qQAA/01t5A000007y53qQAA-1587132467097.png",

         "price": "3.00",
         "inCart": false,
         "sort_order": 1,
        "available_colors": [
          {
             "label": "18 x 12 x 6 White",
             "color": "FFFFFF",
             "image":
"https://swagup-static.swagup.com/platform/media/form/Screen_Shot_2021-04-22_at_1.41.54_PM.png"

          },
          {
             "label": "14 x 10 x 4 White",
             "color": "FFFFFF",
             "image":
"https://swagup-static.swagup.com/platform/media/form/Screen_Shot_2021-04-22_at_1.54.21_PM.png"

          }
        ],
         "supplier_template": null,
         "show_in_bulk_experience": false,
         "show_in_pack_experience": false,
         "items_per_carton": null,
         "carton_parcel_id": null,
         "height": null,
         "weight": null,
         "width": null,
         "length": null,
         "product_type": 1
      }
    ],
     "label": "First up, pick your <span style=\"font-family: Futura; font-weight: bold\">packaging!</span>",
     "is_bonus": false,
     "sort_order": 1
  },
  {
     "id": 20,
     "CatName": "Water bottles",
     "icon":
"https://swagup-static.swagup.com/platform/media/form/water-bottles_xhztx6K.svg",

     "iconActive":
"https://swagup-static.swagup.com/platform/media/form/water-bottles_QDhQYe0.svg",

    "items": [
      {
         "id": 61,
    "salesforce_id":"01t5A000007y45vQAQ"
         "name": "The Elevate Bottle - 27 oz.",
         "description": "This BPA-free bottle features a 27 oz, single wall with a threaded, two-tone lid. \r\n\r\nItem Details: \r\n- 10-3/8\" x 2-7/8\"",
         "img":
"https://swagup-static.swagup.com/platform/media/form/products/01t5A000007y45LQAQ/01t5A000007y45LQAQ.png",

         "price": "7.67",
         "inCart": false,
         "sort_order": 1,
        "available_colors": [
          {
             "label": "blue",
             "color": "31395F",
             "image":
"https://swagup-static.swagup.com/platform/media/form/0685A000007TtlOQAS_Huf2DlG.png"

          }
        ],
         "supplier_template":
"https://swagup-static.swagup.com/platform/media/form/templates/0685A00000BKK3eQAH_h6oTXbO.png",

         "show_in_bulk_experience": true,
         "show_in_pack_experience": true,
         "items_per_carton": null,
         "carton_parcel_id": null,
         "height": null,
         "weight": null,
         "width": null,
         "length": null,
         "product_type": 1
      }
    ],
     "label": "Would you like to add <span style=\"font-family: Futura; font-weight: bold\">water bottles</span> to your packs?",
     "is_bonus": false,
     "sort_order": 2
  }
]
}

* The response examples in this guide have been truncated to show less data

 

In this response, you want to pay special attention to the id which is for the product (item) and salesforce_id fields, which will allow you to get prices and submit an order respectively.

 

Get pack price on demand

Now that you know the products in the catalog, you can get prices. Prices depend on quantities and the number of colors that are going to be present in the design. You should know that these prices are an estimate, and are subject to change during the design phase when color and quantity changes are requested.

 

To get pack prices you can make a POST request to:

 

https://api.swagup.com/form-api/v1/pack-multiple-price/

 

For this request, you need to include information about the products in the pack.

 

Example payload:

 

{
"products": [
  {
     "item_id": 329,
     "units_per_pack": 1,
     "colors": 1
  },
  {
     "item_id": 61,
     "units_per_pack": 1,
     "colors": 2
  }
],
"quantities": [
  {
     "quantity": 100
  }
]
}

This payload states that you want to get prices for two products: 329 (Plain Mailer Boxes) and 61 (The Elevate Bottle - 27 oz.). There will be only one of them in each pack (units_per_pack). Also, the product 61 will have 2 colors in its design, and the price for 100 packs is being requested. In this case you only need to provide the product id in the field item_id and the field salesforce_id is not needed.

 

Example response:

 

{
  "quantities": [
      {
           "quantity": 100,
           "price": "12.47"
      }
  ],
  "products": [
      {
           "item_id": "329",
           "units_per_pack": 1,
           "colors": 1,
          "prices": [
              {
                   "quantity": 100,
                   "price": "3.00"
              }
          ]
      },
      {
           "item_id": "61",
           "units_per_pack": 1,
           "colors": 2,
          "prices": [
              {
                   "quantity": 100,
                   "price": "9.47"
              }
          ]
      }
  ]
}

This response is similar to the request, but you'll get a price key within the quantities key that holds the price for each pack if requesting 100 packs (quantity key). Additionally, the price of each product is present within the products key.

Get individual product prices on demand

Similar to the previous process, if you want to get the price of an individual product(s) instead of pack prices, then you can make a POST request to:

 

https://api.swagup.com/form-api/v1/bulk-pricing/

 

Example payload:

{
"products": [
  {
    "item_id": 275,
"colors": 1,
"quantities": [
{
"quantity": 50
},
{
"quantity": 100
},
{
"quantity": 67
}
]
    }
  ]
}

 

This payload states that you want to get prices for one product as an individual item: product 275 (Plain Mailer Bags). Some difference with pack prices is that the key units_per_pack  is not part of the payload because you are requesting an individual product price. Also, product 275 will have 1 color in its design. In the example above, different prices for different configurations of quantities are being requested at the same time: prices for 50,100, and 67 quantities of that product. In this case, you only need to provide the product id  in the field item_id. Besides, you can send several products as part of the request payload, since the key products is a list, you just need to provide the same structure for each one of these products.

 

Getting the Sizes identification

Each size has its own identifier. You need to use them to represent them on the SwagUp API. To get these identifiers you can make a GET request to:

 

https://api.swagup.com/api/v1/sizes/

 

Example response*:

 

{
 "count": 12,
 "next": null,
 "previous": null,
"results": [
  {
     "id": 10,
     "name": "XXS",
     "category": "Apparel",
     "modified_on": "2019-12-11T21:05:24.554555Z",
     "sort_order": 1
  },
  {
     "id": 9,
     "name": "One Size",
     "category": "Generic",
     "modified_on": "2019-09-15T17:48:09.873973Z",
     "sort_order": 1
  },
  {
     "id": 1,
     "name": "XS",
     "category": "Apparel",
     "modified_on": "2020-12-17T15:13:01.036640Z",
     "sort_order": 2
  },
  {
     "id": 2,
     "name": "S",
     "category": "Apparel",
     "modified_on": "2021-07-07T14:31:20.901393Z",
     "sort_order": 3
  },
  {
     "id": 3,
     "name": "M",
     "category": "Apparel",
     "modified_on": "2021-07-07T14:32:05.465864Z",
     "sort_order": 4
  },
  {
     "id": 4,
     "name": "L",
     "category": "Apparel",
     "modified_on": "2021-07-07T14:30:13.550886Z",
     "sort_order": 5
  },
  {
     "id": 5,
     "name": "XL",
     "category": "Apparel",
     "modified_on": "2020-12-17T15:13:27.681610Z",
     "sort_order": 6
  },
  {
     "id": 6,
     "name": "2XL",
     "category": "Apparel",
     "modified_on": "2020-07-28T17:16:40.096085Z",
     "sort_order": 7
  },
  {
     "id": 7,
     "name": "3XL",
     "category": "Apparel",
     "modified_on": "2020-07-28T17:17:12.210710Z",
     "sort_order": 8
  },
  {
     "id": 8,
     "name": "4XL",
     "category": "Apparel",
     "modified_on": "2020-07-28T17:17:33.706330Z",
     "sort_order": 9
  },
  {
     "id": 11,
     "name": "5XL",
     "category": "Apparel",
     "modified_on": "2020-07-28T17:17:49.615549Z",
     "sort_order": 11
  },
  {
     "id": 12,
     "name": "6XL",
     "category": "Apparel",
     "modified_on": "2020-07-28T17:18:04.441209Z",
     "sort_order": 12
  }
]
}

* The response examples in this guide have been truncated to show less data.

 

Was this article helpful?
0 out of 0 found this helpful

Comments

0 comments

Please sign in to leave a comment.

Articles in this section

Ask a question
Not sure how something works or how to make changes? Don’t worry, we’ll answer all your questions.
Our help desk hours:
9:00am - 4:00pm EST Monday to Friday
Follow us on Twitter
Get the latest news and updates first