Hello,
I am trying to pull simple reports that go beyond Canvas' built-in reports- so I have been working with the API. I have a script I can use to pull what I need, but it's everything- I want to narrow it down to login_id, user_id, and name.
I see that I can deliberately include fields with include[]=fieldname. I don't suppose there's a way to use those additively- that is, only specify the fields I want?
This is the node.js script I am using:
<SPAN class="keyword token">const</SPAN> request <SPAN class="operator token">=</SPAN> <SPAN class="token function">require</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="string token">'request'</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN><BR /><BR /><SPAN class="keyword token">let</SPAN> url <SPAN class="operator token">=</SPAN> <SPAN class="string token"><SPAN>'</SPAN><A class="jive-link-external-small" href="https://" rel="nofollow noopener noreferrer">https://</A><SPAN><my domain>.instructure.com:443/api/v1/courses/12/enrollments?type[]=StudentEnrollment&state[]=active&access_token=<my key>&page=5&per_page=100 rel="next"'</SPAN></SPAN><SPAN class="punctuation token">;</SPAN><BR /> <BR /><SPAN class="token function">request</SPAN><SPAN class="punctuation token">(</SPAN>url<SPAN class="punctuation token">,</SPAN> <SPAN class="keyword token">function</SPAN> <SPAN class="punctuation token">(</SPAN>err<SPAN class="punctuation token">,</SPAN> response<SPAN class="punctuation token">,</SPAN> body<SPAN class="punctuation token">)</SPAN> <SPAN class="punctuation token">{</SPAN><BR /> <SPAN class="keyword token">if</SPAN><SPAN class="punctuation token">(</SPAN>err<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">{</SPAN><BR /> console<SPAN class="punctuation token">.</SPAN><SPAN class="token function">log</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="string token">'error:'</SPAN><SPAN class="punctuation token">,</SPAN> error<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN><BR /> <SPAN class="punctuation token">}</SPAN> <SPAN class="keyword token">else</SPAN> <SPAN class="punctuation token">{</SPAN><BR /> <SPAN class="keyword token">let</SPAN> results <SPAN class="operator token">=</SPAN> JSON<SPAN class="punctuation token">.</SPAN><SPAN class="token function">parse</SPAN><SPAN class="punctuation token">(</SPAN>body<SPAN class="punctuation token">)</SPAN><BR /><SPAN class="keyword token">for</SPAN> <SPAN class="punctuation token">(</SPAN><SPAN class="keyword token">var</SPAN> i <SPAN class="keyword token">in</SPAN> results<SPAN class="punctuation token">)</SPAN> <SPAN class="punctuation token">{</SPAN><BR /> console<SPAN class="punctuation token">.</SPAN><SPAN class="token function">log</SPAN><SPAN class="punctuation token">(</SPAN>results<SPAN class="punctuation token">[</SPAN>i<SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN><BR /> <SPAN class="punctuation token">}</SPAN><BR /> <SPAN class="punctuation token">}</SPAN><BR /><SPAN class="punctuation token">}</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>as you can see I am just manually paging through. If there is way to do this automatically, I would be very interested in that too.
My end goal is a report with the fields mentioned, in a format I could share with instructors.
Any help would be appreciated, thank you.