strange json formatting of materials call

Discussion in 'Shapeways API' started by 225132_deleted, Aug 28, 2014.

  1. hi shapeways,

    i get the feeling the 'get materials' call has a really strange Json structure

    For example this comes out:

    "materials":{
    "6":{
    "materialId":"6",
    "title":"White Strong & Flexible",
    "supportsColorFiles":"0",
    "printerId":"5",
    "swatch":" https:\/\/static1.sw-cdn.net\/rrstatic\/img\/materials\/plas tic_wsf_white.jpg ",
    "restrictions":null
    },

    If i double check the Json documentation at json.org this would mean:
    Object materials -> has object "6" (since "{" denotes the start of an object))

    Since we have multiple materials it sounds logically they should be in some sort of a collection (so all standard json parsing codes now better how to handle it)

    I think it would make sense to put them in an array ( i compared your code with for example some parts of the mailchimp Api )

    "materials": [{
    "materialId":"6",
    "title":"White Strong & Flexible",
    "supportsColorFiles":"0",
    "printerId":"5",
    "swatch":" https:\/\/static1.sw-cdn.net\/rrstatic\/img\/materials\/plas tic_wsf_white.jpg ",
    "restrictions":null
    }, ...other material objects ]



    or am i not seeing something?


    chrs,
    Elco


     
  2. Expanding on this topic,

    if you look at the call to get a single material,

    the properties of the material are at the same level as for example the 'result' string. Which is strange since the result of a call has nothing to do with the material properties.. So there should be an object "Material" : .{ ..... }


    maybe it can contribute in the future.. ;)


    Elco