Tejo Developer: Add and update products

Tags

About 

This page discusses CSRF Tokens.

A list of Other resoruces:

Order API

X-CSRF Token

To get and use your X-CSRF Token please visit here

Add/Update Products Via Rest

Address

POST

 

create_skin_profile/create_skin_profile/RESTAPI

 

Here is example JSON. For new entries all data must be included (except IDs). For updates to old entries include the IDs

EXAMPLE NEW PRODUCT:

 {
        "product_line_name"   :    "Sheer Lip Gloss",
        "body"                :    "This is the world's best lipgloss",
        "brand"               :     1234,
        "price_number"        :     10.00,
        "price_currency_code" :     "USD",
        "variations"          :    {
                                       {
                                         "color_name":   "blue",
                                         "image"     :    base64 encode,
                                         "link"      :   "https://url-to-product.com/page/where/users/check/out",
                                         "in_stock"  :    1
                                       }
                                        {
                                         "color_name":   "red",
                                         "image"     :    base64 encode,
                                         "link"      :   "https://url-to-product.com/page/where/users/check/out",
                                         "in_stock"  :    0
                                        }
                                    }

  }

 

 

THIS RETURNS SOMETHING LIKE THIS:

the number represent IDs that should be saved and used when updating products.

Variations are returned in the order they were given.

 

 {
        "id"          :     11223344,
        "variations"          :    {
                                         1    :    22334455,
                                         2    :    33445566,
                                   }

    }

EXAMPLE PRODUCT UPDATE:

to update an existing product, just include the product id and the fields that need changing.

{
        "id"          :     11223344,
        "body"                :     "Best example text you can find!"
        "variations"          :    {
                                       {
                                         "id"            :    22334455,
                                         "color_name"    :    "teal"
                                       }
                                         "id"            :    33445566,
                                         "in_stock"      :    1
                                   }

    }

 

This will just return the word "success" if everything went well.

 

Tejo runs on Drupal 8. You can always consult D8 documentation for more information.