Any kind of full backup?

maxim_retailitmaxim_retailit Member Posts: 4

Hello. I'm new to Lightspeed so just want to clarify is there a way to make a full "live" account copy and restore it to new separated "dev" account to use it as a sandbox. Currently my best guess is inventory export like this:

  • Request matrix JSON from "live"
  • Create maxtrix on "dev"
  • Request items JSON from "live"
  • Convert JSON to CSV
  • Import CSV on "dev"

First I tried to export an item with Color/Size matrix but it failed: "Attribute 1" was set to "Red", "Attribute 2" to "Small", the manually created matrix contain same values and matrix name is correct but LS Item Import returns an error file with description: Attribute 1 cannot be updated through an import. | Remove Attribute 1 or match existing Attribute 1.


Answers

  • Adrian SamuelAdrian Samuel Moderator, Lightspeed Staff Posts: 572 moderator

    Hey @maxim_retailit,

    The workflow you've specified above is the only cohesive way to do it. Unless you transform the JSON to CSV and then manually profile a file to our imports team to import.

    Adrian Samuel

    API Integrations Consultant - Strategic Solutions

    Lightspeed HQ

  • maxim_retailitmaxim_retailit Member Posts: 4
    edited November 14

    Thank you for the response! Then a few more questions:

    • Is there a way to create multiple matrix from one JSON similar to what is returned by Lightspeed by "GET /API/Account/{accountID}/ItemMatrix.json" request?
    • It is possible to always request a JSON array "ItemMatrix" if there's inly one matrix returned as I'm getting a JSON object "ItemMatrix" instead of an array with single object inside?
    • I'm not sure about creating matrix attribute values as API does not describe fields like "attribute1Values" which supposed to be an array as Lightspeed returns an exception "Can not convert an array to XML when array has numeric indexed values."
    Post edited by maxim_retailit on
  • Adrian SamuelAdrian Samuel Moderator, Lightspeed Staff Posts: 572 moderator

    No worries @maxim_retailit!

    Q1): Is there a way to create multiple matrix from one JSON similar to what is returned by Lightspeed by "GET /API/Account/{accountID}/ItemMatrix.json" request?

    A : No, we have no bulk write methods on our endpoints.


    Q2) It is possible to always request a JSON array "ItemMatrix" if there's inly one matrix returned as I'm getting a JSON object "ItemMatrix" instead of an array with single object inside?

    A: I'm afraid not, your business logic is going to have to determine whether it's an array or not and handle it accordingly.


    Q3)I'm not sure about creating matrix attribute values as API does not describe fields like "attribute1Values" which supposed to be an array as Lightspeed returns an exception "Can not convert an array to XML when array has numeric indexed values."


    A) So the API throws an error because you don't assign attributes arbitrarily onto a Matrix via the API. That's something you can only do via the UI.


    You must define the attributes as they are associated with specific items.

    So the steps are:

    1) Create ItemMatrix using ItemMatrix endpoint


    2) Assign item to itemMatrixID and also set attributes:

    An example of such a payload would be this:

    METHOD: PUT

    URL: https://api.lightspeedapp.com/API/Account/Item/{{itemID}}.json

    Payload:

    {
      "itemMatrixID": {{itemMatrixID}}, 
      "ItemAttributes": {
        "attribute1": "{{attribute 1}}",
        "attribute2": "{{attribute 2}}",
        "itemAttributeSetID": {{itemAttributeSetID}}
      }
    }
    

    I hope this serves to answer your questions!

    Adrian Samuel

    API Integrations Consultant - Strategic Solutions

    Lightspeed HQ

Sign In or Register to comment.