Download Schema using Canvas CLI

dhenry636
Community Member

I know that a very similar question has already been asked.  But I was wondering, specifically, can the Canvas Data CLI be used to update just the schema.json file?  I just created a simple batch file, like the one below, but it gets an error if the schema.json file has not been placed in the dataFiles folder.  I know how to retrieve the schema by doing a full sync, or by using the url https://portal.inshosteddata.com/api/schema/latest.  But for the sake of consistency and simplicity, can I use the canvasDataCli command to retrieve the schema.json file?

This is a shorter version of a batch file I have so far. Does this seem like it would work?  And can I download schema.json in it before the other commands?

@ECHO ON
call canvasDataCli fetch -c C:\nodejs\canvas\config.js -t account_dim
call canvasDataCli fetch -c C:\nodejs\canvas\config.js -t course_dim
call canvasDataCli fetch -c C:\nodejs\canvas\config.js -t user_dim
call canvasDataCli fetch -c C:\nodejs\canvas\config.js -t communication_channel_dim
call canvasDataCli fetch -c C:\nodejs\canvas\config.js -t pseudonym_dim
call canvasDataCli -c C:\nodejs\canvas\config.js unpack -f account_dim course_dim user_dim communication_channel_dim pseudonym_dim

If I don't add the schema.json file first, I get this error:

an error occured
{ [Error: ENOENT: no such file or directory, scandir 'C:\Scripts\dataFiles\account_dim']
errno: -4058,
code: 'ENOENT',
syscall: 'scandir',
path: 'C:\\Scripts\\dataFiles\\account_dim' }
Error: ENOENT: no such file or directory, scandir 'C:\Scripts\dataFiles\account_dim'