Skip to content
View in the app

A better way to browse. Learn more.

Loyverse Town

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Problem with uploading product

Featured Replies

I'm trying to upload a new product using exsisting data. It basically is a copy of one product but with a new barcode and SKU. When I upload the file using post it just doesnt upload.. Do I need to make more changes to the file before I can use it as a new product?

Hi!|Could you tell, please, you use import feature or API to add items?

  • Author

Hi! I use the API. It is a python script that uses POST to upload the new item

Please show example request url, request json and response json.

Edited by Jay Rock

  • Author

import requests

 

productid='placeholder'

url = 'https://api.loyverse.com/v1.0/items/'

headers = {'Authorization' : 'Bearer placeholder'}

newean = '99999999' 

 

json_obj = requests.get(url+productid, headers=headers).json()

 

json_obj['id'] = ''

json_obj['variants'][0]['variant_id'] = ''

json_obj['variants'][0]['sku'] = newean

json_obj['variants'][0]['barcode'] = newean

 

r = requests.post(url,json=json_obj,headers=headers)

 

---------------------------------

I use the json i recieve from the API. I just edit a few entries and then reupload it.

Sorry don't understand give me an example something like:

request ->

POST https://api.loyverse.com/v1.0/items

{
  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  "item_name": "T-shirt",
  "reference_id": "string",
  "category_id": null,
  "track_stock": false,
  "sold_by_weight": false,
  "is_composite": true,
  "use_production": false,
  "components": [
    {
      "variant_id": "8a2d415d-59aa-4132-bef3-011f97c4a0f6",
      "quantity": 0
    }
  ],
  "primary_supplier_id": "dbfc5105-b3ab-4b57-a47f-d7de696f8430",
  "tax_ids": [
    "497f6eca-6276-4993-bfeb-53cbbbba6f08"
  ],
  "modifiers_ids": [
    "string"
  ],
  "form": "SQUARE",
  "color": "GREY",
  "option1_name": "Size",
  "option2_name": "Color",
  "option3_name": null,
  "variants": [
    {
      "variant_id": "8a2d415d-59aa-4132-bef3-011f97c4a0f6",
      "item_id": "4d8cd62e-a579-4dae-af8c-3172f96f8f7c",
      "sku": "string",
      "reference_variant_id": "string",
      "option1_value": "Large",
      "option2_value": "Green",
      "option3_value": null,
      "barcode": "string",
      "cost": 0,
      "purchase_cost": 0,
      "default_pricing_type": "VARIABLE",
      "default_price": null,
      "stores": [
        {
          "store_id": "string",
          "pricing_type": "FIXED",
          "price": 0,
          "available_for_sale": true,
          "optimal_stock": null,
          "low_stock": null
        }
      ]
    }
  ]
}

 

 

Response: 

{

"errors": [

{

"code": "some status",

"details": "some error text will be here"

}

]

}

  • Author

{'id': '', 'handle': 'testartikel_api-1', 'reference_id': None, 'item_name': 'Testartikel_API', 'track_stock': False, 'sold_by_weight': False, 'is_composite': False, 'use_production': False, 'category_id': None, 'components': [], 'primary_supplier_id': None, 'tax_ids': ['74aa630b-71b4-11ea-8d93-0603130a05b8'], 'modifier_ids': [], 'form': 'SQUARE', 'color': 'GREY', 'image_url': None, 'option1_name': None, 'option2_name': None, 'option3_name': None, 'created_at': '2020-10-03T11:09:01.001Z', 'updated_at': '2020-10-08T12:34:52.052Z', 'deleted_at': None, 'variants': [{'variant_id': '', 'item_id': 'aa4a2fcb-3802-4b74-96b0-535b1030c9fd', 'sku': '10156', 'reference_variant_id': None, 'option1_value': None, 'option2_value': None, 'option3_value': None, 'barcode': '10156', 'cost': 0.0, 'purchase_cost': None, 'default_pricing_type': 'FIXED', 'default_price': 20, 'stores': [{'store_id': 'f92eb0c5-711d-11ea-8d93-0603130a05b8', 'pricing_type': 'FIXED', 'price': 20, 'available_for_sale': True, 'optimal_stock': None, 'low_stock': None}, {'store_id': 'f92eb0fb-711d-11ea-8d93-0603130a05b8', 'pricing_type': 'FIXED', 'price': 20, 'available_for_sale': True, 'optimal_stock': None, 'low_stock': None}, {'store_id': 'f92eb0aa-711d-11ea-8d93-0603130a05b8', 'pricing_type': 'FIXED', 'price': 20, 'available_for_sale': True, 'optimal_stock': None, 'low_stock': None}], 'created_at': '2020-10-03T11:09:01.001Z', 'updated_at': '2020-10-08T12:34:54.054Z', 'deleted_at': None}]}

 

the id and the variant_id I leave empty so it will become a new product

I tried to send your request, and receive response:

{

"errors": [

{

"code": "INVALID_VALUE_TYPE",

"details": "The value must be an UUID",

"field": "object.id (line: 2, column: 11)"

}

]

}

 

 

if you have the same error, you should send

"id": null

instead "id": ""

Looks like empty value Loyverse recognize as uuid

  • Author

thank you very much! this worked for me 🙂

 

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.