How to get a share configuration link through code?

vikram_s
Hi @Will, Please let us know how we can get the copy link through the coding-end? Thank

Comments

13 comments

  • Comment author
    vikram_s

    Hi @Will, Please let us know how we can get the copy link through the coding-end?

     

    Thank

    0
  • Comment author
    William Thompson

    Hi Vikram, in order to create a share link you will need to POST to our Configurations API, which Saves the configuration of a product and generates a shortID which can be used to retrieve the configuration, in place of the UUID.

    Once you have the shortID, you can simply add the parameter ?tkcsid=${SHORT_ID} to the URL where the Threekit player is. When someone uses the link with the Threekit params, they will see the item as configured. Ex: http://example.com/?tkcsid=EXIPiBA56

    Let me know if this is helpful!

    0
  • Comment author
    vikram_s

    As per documentation we need to send shortId for save the configuration.

    But we have no shortId when we call the save configuration API. We can get shortId in response only after save the configuration.

    0
  • Comment author
    William Thompson

    Not every parameter is required, you can leave out files, shortId, customerId, and metadata if you do not have data for them. For example you can post with a body like this:

    {
      "orgId": "7f6a52b7-a10b-4945-836a-5fecc24ee914",
      "productId": "e5d536ec-e89c-46fc-8773-7e54ba70517a",
      "productVersion": "exampleVersionNumber",
      "variant": {
        "ExampleVariantField1": "ExampleValue1"
      },
    }
    

    variant is the configuration of the item.
    productVersion is whatever you would like it to be.

    0
  • Comment author
    vikram_s

    @Will , When we are trying to call API from the postman with private token getting response correctly, but I am trying with dev-kit getting below CORS error :-

    Access to fetch at ‘https://preview.threekit.com/api/configurations’ from origin ‘http://localhost:3000’ has been blocked by CORS policy: Response to preflight request doesn’t pass access control check: No ‘Access-Control-Allow-Origin’ header is present on the requested resource. If an opaque response serves your needs, set the request’s mode to ‘no-cors’ to fetch the resource with CORS disabled.

    Also, I have whitelisted http://localhost:3000 domain for bear token

    0
  • Comment author
    William Thompson

    For a server-side API you must use a private token. Please use a private token and let me know if that resolves your issue.

    0
  • Comment author
    vikram_s

    (post deleted by author)

    0
  • Comment author
    vikram_s

    Ok let me try, Will update you soon.

    0
  • Comment author
    William Thompson

    @vikram_s if you are using the dev-kit can you look at this section of the docs and see if it is more applicable to you?

    0
  • Comment author
    vikram_s

    Getting response after call from server side : -

     

    0
  • Comment author
    William Thompson
     
    vikram_s:

    Getting response after call from server side

    Did you make this call with a public token and a no-cors mode? Server-side API calls must be made with a private token. If you are using the dev-kit, follow the docs on github.

    0
  • Comment author
    vikram_s

    Now I am calling from server side using PHP with private token.

    0
  • Comment author
    William Thompson

    Can you please DM me the details for the API call? Everything if you don’t mind: code, tokens, etc. And please invite me to your Threekit org: wthompson@threekit.com I will check into it!

    0

Please sign in to leave a comment.