Is there a way to get all models in a single call?

Discussion in 'Shapeways API' started by SmallDesignFirm, Jan 7, 2014.

  1. Hi there,

    It looks like GET /models/v1 is designed to return paged results. Is there a way to get it to return all results in a single call? I'd expect it to do this by default, but it looks like the default is to return a single page (36 results).

    We've got well over 36 models, but the node reference client only displays 36.

    thanks,

    -Morgan
     
  2. pwalker
    pwalker Member
    I'd like to second this.

    The specification is missing information on how to include the 'page' parameter in the URL. I'd assumed it went in the request body but that is unusual for a GET request. In any case including the page in the request body in either JSON or form data format doesn't change pages.

    This affects my shapeways-python project, here is the issue: https://github.com/pauldw/shapeways-python/issues/1
     
  3. stonysmith
    stonysmith Well-Known Member Moderator
    GET /model/v1?page={page} is working just fine for me.
    I set a variable to 1, call for the first page, then increment the page# and loop until the response is null.
    It's giving me all 384 items currently in my shop.

    ===
    Of note however is that if you want to then read the individual Model Info with GET /models/{model_id}/info/v1 ... those requests are throttled at 150 per three minute period - you'll get a message back saying "please wait 180 seconds"
    The simple way around this is to add a quarter second delay between each GET by using time.sleep(0.25)
    Then it'll read thru the entire list with no problems.

    This throttling "feature" has been noted with the developers.
     
    Last edited: Jan 8, 2014
  4. Thanks for the info!
     
  5. @stonysmith -- are you aware of any throttles on PUT /models/info/v1? I'm writing a script to upload a batch of 500 models.
    thanks,
    -Morgan
     
  6. pwalker
    pwalker Member
    Thank you for this information!

    I had tried this as a guess, but it turns out I was not properly signing the query string, so for example /models/v1?page=1 was returning a 401 Unauthorized error.

    Now fixed.
     
  7. AlanHudson
    AlanHudson Shapeways Employee Dev Team
    There is throttling in place on uploads as well. I don't have the number off hand but our servers would appreciate some delay in between models anyway. I'd suggest adding 30 seconds between models. I had a friend upload 6K models with that delay and it went fine.
     
  8. AlanHudson
    AlanHudson Shapeways Employee Dev Team
    There is throttling in place on uploads as well. I don't have the number off hand but our servers would appreciate some delay in between models anyway. I'd suggest adding 30 seconds between models. I had a friend upload 6K models with that delay and it went fine.