4

Calling IO3D.services results in:

Uncaught (in promise) TypeError: Cannot read property 'call' of undefined

version: https://3d.io 1.0.0-beta.22 (@master #274adf0 2017/08/02 10:16)

What i tried:

IO3D.services.call('Model.search', {
    arguments: {
        organizationResourceId: <my_organisationResourceId>,
        folderResourceName: '<my_folder_name>',
    },
}).then(console.log)

So is the services-api not available yet?

Jonathan Hall
  • 75,165
  • 16
  • 143
  • 189
meme
  • 83
  • 5

2 Answers2

3

to call APIs directly use:

IO3D.utils.services.call( )

sample on jsfiddle: https://jsfiddle.net/0f6n8wp0/

services.call function in the library: https://github.com/archilogic-com/3dio-js/blob/master/src/utils.js#L24

Frederic
  • 326
  • 1
  • 5
1

So far it is available as an experimental feature only:

IO3D.utils.services.call('Model.search', {
  arguments: {
    organizationResourceName: 'template',
    folderResourceName: 'default',
  },
}).then(console.log)

JsFddile: https://jsfiddle.net/3dio/ykut9gx1/

Once out of experimental stage it we available in it's own namespace as something like IO3D.scene.search(…)

tomas polach
  • 153
  • 1
  • 9
  • Thanks a lot! Works perfectly. Tried to also use `organizationResourceId`instead of `organizationResourceName`. Is this also panned? – meme Aug 02 '17 at 15:11
  • Good point! Using permanent IDs as params would be certainly more solid than using changeable names. We will consider that in our API design. – tomas polach Aug 02 '17 at 17:18