Just tried it out @nnhubbard and it doesn’t seem to make a difference - integer or string on createAsset, it works either way.
Just tried the createFileAsset function again and it still doesn’t work - quoting or not quoting the parent ID. I can also see that there’s no reference to createFileAsset in the Details screen of the Javascript API asset - the tick boxes that allow you to restrict what functions are available.
What exact version are you on? I’d say this is probably a bug, can’t remember if it’s been fixed though.
Creating file assets with the JS API has always been tricky as Matrix usually requires an actual binary file to also be submitted in a file asset creation which is what happens in the backend UI.
friendly_name is a badly named parameter - it’s actually filename in spirit so it needs to be an actual filename. That’s why it’s complaining about invalid blank extension. Make sure friendly_name is an actual .pdf filename and it works.
Do you mean change friendly_name to filename on the left hand side (in the parameters)? I’ve done that now and, although it has moved on, it’s now producing the following error:
I’ve literally just copied and pasted the example code from the manual to try and get started - that’s what was in my original post.
I’ve tried adding ‘.pdf’ to the end of the filename too and get the same error (above).
I’m guessing this latest error means that there’s a step to undertake before you can use createFileAsset - actually uploading a file? This isn’t documented and ‘createFileAsset’ suggests it’s just that - a function to create the file in the first place. What has been your experience?
I’m guessing there’s a missing name parameter, based on the error above but again, nothing in the docs to suggest that’s needed.