Help with Automatic Ordering from my Site?

Discussion in 'Shapeways API' started by Bathsheba, Mar 17, 2013.

  1. Bathsheba
    Bathsheba Well-Known Member
    So I'm looking at the API docs with my 1990's web brain...

    This setup automates uploading a model, so you can link a customer to its page, OK. And it can put a model in the cart. But it's your cart, right? I.e. you can't put a model in a cart and then refer the customer to that cart so they are prompted to check out with it?

    But here's my real question. At Shapewright and MixeeMe, when you buy a model you check out through their sites, you don't visit Shapeways at all. I understand how the API is sending those models to SW. But it seems like it doesn't automate passing a shipping address, or any other customer information. Does that mean these setups have a human being who every day looks at their incoming orders and turns around and types them into SW's cart? They'd have to check out with each one individually, since they're all going to different addresses. :cry:

    Or are they having every day's huge (I imagine) cartful of models shipped to themselves and then forwarding them to customers? That seems even more unscalable. :dead:

    I want to join the club and have a geometry generator and make it automatically sell models fulfilled by SW. But I'd like my customers to check out through my own site, and I don't want to have to touch the orders. It looks like these sites must be doing that, but I'm not getting how.

    Can someone point me in the right direction?

    Last edited: Mar 17, 2013
  2. admin_nathan
    admin_nathan New Member
    Hey Bathsheba,

    With the API, you ask for permission to work with a user's account and then you can upload, add to cart, etc to that user's account. The user's access token is what gives you this permission. See this page for a description on how this works:

    If you want to upload the model to your account, but add that model to the customer's account, you would need both your own access token (different than your consumer key) and the customer's access token. When uploading, use your access token. When adding to cart, use the customer's. At that point, you can redirect the customer to so they can checkout.

    One caveat in this system - you can only add a public / for sale model to cart via the API (unless you're adding it to the model owner's cart), so when you upload the model make sure to choose your visibility settings appropriately.

    - Nathan
  3. Bathsheba
    Bathsheba Well-Known Member
    Hi, thanks for getting back!

    I can't say I understand this from the docs -- is "consumer" me or the customer? -- but probably it will make more sense when I start coding. OK, this would solve my first question of how to put something in the cart and let the customer check out with it.

    What about what MixeeMe is doing -- checkout on their own site and then fulfillment though Shapeways -- is that supported? I get that I can put a model in my own cart, but l'm not seeing anything about how to set a different shipping address.

    This is very sad, because one purpose here is to enable sales of individually customized items. If the items have to be left as public/for-sale, then I can't tell the customer he's getting a unique build that no one else will have.

    Any hope to improve on that?

    Thanks much,
    Last edited: Mar 18, 2013
  4. admin_nathan
    admin_nathan New Member
    The "consumer" is your "app" that gets access to a user account (yours or the customer's).

    We don't support order placement via the API (except for add to cart). A customer must check out on if you want no part in the fulfillment.

    I believe we will eventually support private models via the API.
  5. Bathsheba
    Bathsheba Well-Known Member
    Thanks for clarifying! Much appreciated.

    I live in hope.

    Thanks again,
  6. MrNibbles
    MrNibbles Well-Known Member
    After a cursory look at the API information I'm thinking my 1980's computer science courses consisting of FORTRAN and assembly language programming are not going to cut it in this endeavor. Where's the Shapeways API for Dummies book when you really need it?
  7. admin_nathan
    admin_nathan New Member
    Hey MrNibbles,

    It may be useful to look at some of our reference clients on github - - if you have a background in computer science it shouldn't be too difficult to decipher the example code and write some of your own :)

    - Nathan
  8. MrNibbles
    MrNibbles Well-Known Member
    Thanks for the information link. As an RF electrical engineer I could easily design you a microwave amplifier or a radio receiver but I may have finally met my match trying to do this. Not that I won't take it as a challenge to try of course! A framework or check list of basic instructions along with good examples of a simple test case are always a good starting point. When all else fails, outsource! :D
  9. whughes98144
    whughes98144 New Member
    Wow, I agree that this is mostly what I'd hope for as well with this API: automatic fulfillment. If we can't specify a different shipping address when placing orders, then this doesn't do me much good.

    Just 'adding to cart' is a good first start but you need all the additional steps to place the order, the first step of which is 'Shipping address".

    I'm perfectly happy with all orders going through my account, but I need to be able to ship them elsewhere. I understand Shapeways concern of 1000 orders getting placed via computer with 1000 different addresses, all for the same part. Or worse, all with *slight* differences. I have no idea how you actually figure out which piece is which order currently, as they're all just this jumble in a big vat of powder, right?

    Regardless, what I think the API community (all 3 of us?? ;->) is to be able to take this to its logical conclusion.

    And understand, what I'm trying to write is an *AMAZON* connector. (Queue scary music)


  10. Bathsheba
    Bathsheba Well-Known Member
    Guys, I love you and know that you want the best for us, but OAuth isn't working for me.

    I'm not a stranger to APIs. My site interfaces every day with UPS, USPS, Paypal, Quickbooks, my credit card processor, my fulfillment house, and my laser glass supplier. I wrote all the code to talk to their different APIs, with my own fingers. But this API...I'm a shopkeeper, it's many years since I programmed professionally. I can't spend this much time getting up to speed on authentication protocols that the modules for aren't even finished yet. I understand that it's the latest and most awesome thing, and that you thought about it carefully, and that it does a very clever thing which I'm sure will be useful to brighter people than me, but -- I have to tell you -- it's an unbelievable hairball and I don't need this functionality.

    I don't need a sophisticated three-legged authorization process. I just want to upload and buy parts -- with me as your customer -- and get them shipped to people. I'm hoping to do this so often that I need to automate it.

    Can we have a simple API where my site can log in and do that?

    I promise you won't need to deal with the people I'm shipping to. I'm your customer here, and responsibility for downstream interactions stays with me.

    You won't miss out on reaching these people. Shapeways will be linked from the site that does this, as it is from almost every page of my site. People will get their packages with your branding. Every transaction through this setup is a safe transaction because it's with me, your known customer, and also it puts your name and work in the hands of someone new, in the best possible way.

    I swear to God that if you do this I will try really hard to sell a lot of parts. But I've put in a great deal of time and effort trying to work with your current setup, and I can't make it make sense, either intrinsically or in terms of what I'm trying to do.

    Help me out here?

    Thanks as always,
  11. admin_nathan
    admin_nathan New Member
    Bathsheba - OAuth is an important and necessary step in integration with the API. What language are you using? Maybe we can help you get it working.

    - Nathan
  12. Bathsheba
    Bathsheba Well-Known Member
    Perl, sadly. I have Net::OAuth[::Simple|::Client], but the methods they offer don't seem to correspond with the PHP that you have up.

    If you can show me an example I would be interested and grateful.

    Using Net::OAuth I got as far as authenticating a user and obtaining access token/secret, but so far I am not able to understand how to upload a file. I would appreciate an example on this. As far as I can tell there is no example on the Internet of someone successfully using Perl with this protocol to send user data. (One guy said he did it but apparently forgot to attach the final (working) draft of his code to his BBS post.)

    *sigh* This is a lot of work for something that doesn't close the sale. Is there no possibility of adding checkout capability? I don't want to check customers out, I just want to finish transactions as myself. Is there a reason that can't happen? I thought we were friends.

    Last edited: Apr 10, 2013
  13. Bathsheba
    Bathsheba Well-Known Member
    I have with great difficulty succeeded in uploading a model using Perl with Net::OAuth.

    Still my question. I'm implementing this to brush up my skills and in the hope that it will become useful later, but checkout is what's needed here.

    Again, I live in hope...
    Last edited: Apr 10, 2013
  14. hgbrian
    hgbrian New Member
    I agree with Bathsheba's points here.

    I was very surprised that the model has to be made public -- this doesn't work for many (most?) purposes. If MixeeMe and Shapewright are taking and fulfilling orders themselves and creating models on shapeways manually, that seems to defeat the purpose of the API.

    Is the API still under active development?

    [EDIT: Sorry, I didn't realize that this site was in fact brand new! I am still curious about plans for developing the API to accommodate printing non-public models and shipping them to different customers.]
    Last edited: Apr 9, 2013
  15. Bathsheba
    Bathsheba Well-Known Member
    Is there a way to set the default material of a model?
    Last edited: Apr 10, 2013
  16. admin_nathan
    admin_nathan New Member
    I don't believe that option is currently supported, but I'll raise it internally since it should definitely be available.
  17. FabMeJewelry
    FabMeJewelry New Member
    The API is for the superior shop owner i think ? When I'm not designing I program 4 different kind of welding robot's but that's kindergarten compared to this :D

    Is it possible to make some API code generators for different uses, make it easy just like !
  18. saida
    saida New Member
    After trying the API myself, I would like to second Batsheba and some of the others here, despite the thread not exactly being new.

    My customers are not necessarily Shapeways users. They are not experts. That's why they use my site for getting things designed rather than uploading their own STLs.
    Requiring them to sign in to Shapeways when buying makes it a truly customer nightmare process for those that don't already have an account, whereas - as Batsheba said - no marketing effort is lost with all the remaining branding possibilities for Shapeways.

    The main concern is that customers want one accountable vendor. If they have to log in to other stores along the process, they'll be asking themselves: 2 logins for one order? Are they trying to turn me away, or who will be responsible if my order goes wrong?
    That's a showstopper.

    I wonder how many people suffer the same issue of not being able to take orders without having to route customers back and forth, and just order on behalf of their customers through Shapeways, using the address details provided by the customer.

    It looks from this thread like there are quite many, and to me it looks like even featured shops such as mixeelabs et al have to "deal with homebrew code" (see "mixeelabs question" in forum) to close the deal.

    The use-case above would be simply solved with a private key that's capable of connecting to your own account, plus setting a shipping address and that's it!

    As I see it, OAuth addresses a different need, the "Jane wants to print her flickr photos on without giving away her flickr password". For those of us who want to create customized products, the customer does not already have them stored on their private 3dflickr. Even printing from thingiverse to shapeways would be different because those files are public anyway, so no need for tokens.
    What is the main use-case behind the OAuth then?

    Would be glad to hear Shapeways thoughts, have you spent any thought about making the shipping part easier in the meantime? Or is there already some feature I have missed?
  19. stonysmith
    stonysmith Well-Known Member Moderator
    Those API calls were written before Shapeways updated the site to allow "guest" purchases.

    Just thinking about what would be required... Some kind of 'session' identifier would have to be created on the behalf of the buyer and passed back and forth between your site, Shapeways, and the buyer's browser. Keeping all of that secure might be tricky.
  20. saida
    saida New Member
    OK lets see if we can build a case. The need is for shops who help users create custom products (and produce them via Shapeways) to automatize their customers orders via Shapeways, while not asking customers to leave the shop (plus allowing private products, just to be complete).

    I've checked the first few api discussion link, writing down the names of users that seemed to request this explicitely:
    - batsheba, whughes98144, hgbrian (this thread)
    - Kandam90, pupworkshop, MixeeMe, alexivanovic ( &start=0&)
    - FearlessForms ( &start=0&)

    I've stopped there... I haven't counted a number of others that weren't able to figure out how to integrate with the existing api (which I suspect might be for the same reason, that the api is not targeted enough at their need)

    Then, looking at some apps that are featured in shapeways app page: Batsheba, nervous systems, Mymo, Kinematics, MixeeMe, Pupworkshop, Freakin sweet apps.. they all seem to have in common that they would benefit from an automated ordering system.

    In summary I think there's a need.

    Regarding what would be required: I may be oversimplifying this but I don't think it's a whole lot.
    Stores want to ask customers for shipping addresses and then (automatically) ask Shapeways to make and send products to them, via the API.

    I don't think sessions would have to be passed. Take a similar process:
    When I order on Shapeways, I'll get a UPS package with my thing. But I'll never have any interaction with UPS. UPS will just assume Shapeways is handling the interaction with me as a customer, and also if my thing never arrives I'm most likely going to Shapeways first. Lets say UPS claimed they never got the order. I would then have the expectation that Shapeways deals with UPS, not myself.

    To come back to our situation, I would see a similar process:
    - I'm using the shapeways API to calculate my custom models prices, material etc.
    - my customer selects the object, orders, pays me and provides a shipping address.
    - I'll then deal with Shapeways to make the order happen and get it delivered to the customer

    And that's what already happens now. It's just so manual that - unless I'm missing something - is rather a pain and doesn't scale at all => less shops and less income for Shapeways.

    But Shapeways already has all the infrastructure to make it happen. I'm thinking about a solution along these lines:
    - customer designs with the help of my shop (I use existing APIs to check price etc) - Done
    - customer orders, providing me with an address and paying for the order (paypal, stripe etc) - Done
    - I have a static API key to programmatically connect to *just* my own shapeways shop. After checking into OAuth1 I see that an authorized auth_token should never expire, so I can use that as my API key - Done
    - Now, I simply need to make an order to a custom address and send you the money, all *from within* my shop. That's similar to UPS getting the order from Shapeways, not from the customer.
    1. For the money transfer, I could make a manual bank transfer covering any number of orders - Done.
    2. I need to have an API call sequence somewhere along these lines:
    .setShippingAddress(), .getShippingPrice(), .getTotalAmount(), maybe .getOrderSummary(), and .checkout().

    That would be it. No additional tokens etc.
    Am I missing something?