Python Api Parameter - For Sale, Or Not For Sale

Discussion in 'Shapeways API' started by meikltest, Oct 26, 2019.

  1. meikltest
    meikltest Member
    Hi all,

    new to the API and also not a developer per education, but playing around and try to learn.

    Ok, so my question is hopefully simple for those of you familiar with the Python API:

    When I upload a local stl file via POST, it all seems fine: code is running through, links are generated, model is there. As I would like to sell it, I set the parameter "isForSale" to "1". I thought this would have an effect on the model that I access via the public link, but there it still says "Not For Sale".

    Can someone tell me whether I miss something here?

    Thanks

    Michael

    upload_2019-10-26_12-33-14.png
     
  2. stonysmith
    stonysmith Well-Known Member Moderator
    Did you includea set of materials, and set their prices?

    "materials":{
    "6":{
    "materialId":6,
    "markup":0, #i believe this is no longer used
    "isActive":1,
    "price":4 #set the total price for the item.
    },
    ...
    ...
    },
     
    meikltest likes this.
  3. meikltest
    meikltest Member
    I did now, and it worked! Got the pricing and the option to buy. Thanks a lot for your fast reply! :)
     
  4. Wesen
    Wesen Member
    I have the same problem.

    But perhaps I'm a little confused. We used to upload a model and spec a material and markup. Shapeways calculates the price, I always left that blank. How are we supposed to set the price in advance if we don't know it yet?
     
  5. Wesen
    Wesen Member
    I also tried setting the material price to an arbitrary number, but no luck - still not for sale.
     
  6. Antlitz
    Antlitz Member
    Hey,

    I have the same problem! I am pretty certain I have posted exactly the right data and made very sure that it went through (isForSale, model printability, material prices, markups, isActive, default MaterialId and everything else in pretty much all combinations). I have even updated the data using updateModelDetails. It seems the issue is the variants Option and their corresponding "view-toggles" under "Pricing and Model Files. For me those visibility toggles are disabled by default (even though again i set the materials to "isActive" : 1 ). If I enable those or simply select an option from the variants dropdown the Model becomes sellable. As far as i understand there is currently no versions api unfortunately and I haven't found any parameters corresponding to the view flags.Do I have to resort to writing a web script or is there a solution to this problem? I am using the private method, if that is of concern.

    Thank you very much!
     
    Last edited: Dec 19, 2019
  7. Wesen
    Wesen Member
    Confirmed: manually adding a variant makes the model sellable.

    Perhaps this is a recent change to the API. I only noticed it this week, before it was working as expected.
     
  8. Wesen
    Wesen Member
    Even more interesting: Clicking 'Edit product' on a model uploaded via the API, not changing any data and clicking 'Save' makes the model for sale.
     
  9. Wesen
    Wesen Member
    It would be great if a Shapeways API developer or insider could confirm whether a recent change to the API might have caused this issue.
     
  10. Antlitz
    Antlitz Member
    Hi,

    the shapeways API team is super helpful via mail (api@shapeways.com). They helped me fix the problem. I don't know your specific case though. For me and my workflow what worked was to at first only upload the model without the isForSale flag or any material info at all and only later add the isForSale Flag (after i polled the printability = true parameter) and material info via "updateModelDetails" PUT method. Now my model is for sale.

    Maybe it helps you too :)
     
  11. Wesen
    Wesen Member
    Thanks for the tip! I'll give it a shot.
     
  12. Wesen
    Wesen Member
    Thanks Antlitz, the same process worked for me.