Hey Elliot,
I have had success adding a teacher group ID as <class><teacher_group_ids>$exampleID</teacher_group_ids></class>. To modify a student group, it is similar - you should just need to swap teacher_group_ids for student_group_ids: <class><student_group_ids>$exampleID</student_group_ids><class>.
-William
Hey Elliot,
I have had success adding a teacher group ID as <class><teacher_group_ids>$exampleID</teacher_group_ids></class>. To modify a student group, it is similar - you should just need to swap teacher_group_ids for student_group_ids: <class><student_group_ids>$exampleID</student_group_ids><class>.
-William
Hi William,
i'm not having much luck. The API call appears to work and doesn't throw any errors but when you look in the WebUI nothing has changed.
Here's my code. (i'm using powershell)
xml = "<class><student_group_ids>443</student_group_ids></class>"
$headers=@{}
$headers.Add("Accept", "application/json")
$headers.Add("Content-Type", "application/xml")
$headers.Add("Authorization", $tokenAuth)
Invoke-RestMethod -Uri "https://$JamfTennantId/JSSResource/classes/id/$classID" -Method PUT -Headers $headers -Body $xml
The Terminal Response for an Invoke-RestMethod is:
xml class
--- -----
version="1.0" encoding="UTF-8" class
The Terminal Response for an Invoke-WebRequest is:
StatusCode : 201
StatusDescription : Created
Content : <?xml version="1.0" encoding="UTF-8"?><class><id>441</id></class>
RawContent : HTTP/1.1 201 Created
Date: Tue, 03 May 2022 10:13:39 GMT
Transfer-Encoding: chunked
Connection: keep-alive
Set-Cookie: AWSALB=oJNqvjCX5r0o38lkvMLHbQYby52G6BBj9JU+Fyvq2FA/v0hPkOG253BATYMEs+7zYPeIPgaBCt…
Headers : { Date, System.Stringn]], ,Transfer-Encoding, System.Stringn]], ,Connection, System.Stringn]], ,Set-Cookie, System.Stringn]]…}
Images : {}
InputFields : {}
Links : {}
RawContentLength : 65
RelationLink : {}
Would you be willing to share your working code?
Thanks,
Elliot
Hi William,
Just in case it matters, I thought i'd just clarify that we're using jamf cloud which is running the latest version 10.37.2.
Thanks,
Elliot
Hi William,
i'm not having much luck. The API call appears to work and doesn't throw any errors but when you look in the WebUI nothing has changed.
Here's my code. (i'm using powershell)
xml = "<class><student_group_ids>443</student_group_ids></class>"
$headers=@{}
$headers.Add("Accept", "application/json")
$headers.Add("Content-Type", "application/xml")
$headers.Add("Authorization", $tokenAuth)
Invoke-RestMethod -Uri "https://$JamfTennantId/JSSResource/classes/id/$classID" -Method PUT -Headers $headers -Body $xml
The Terminal Response for an Invoke-RestMethod is:
xml class
--- -----
version="1.0" encoding="UTF-8" class
The Terminal Response for an Invoke-WebRequest is:
StatusCode : 201
StatusDescription : Created
Content : <?xml version="1.0" encoding="UTF-8"?><class><id>441</id></class>
RawContent : HTTP/1.1 201 Created
Date: Tue, 03 May 2022 10:13:39 GMT
Transfer-Encoding: chunked
Connection: keep-alive
Set-Cookie: AWSALB=oJNqvjCX5r0o38lkvMLHbQYby52G6BBj9JU+Fyvq2FA/v0hPkOG253BATYMEs+7zYPeIPgaBCt…
Headers : { Date, System.Stringn]], ,Transfer-Encoding, System.Stringn]], ,Connection, System.Stringn]], ,Set-Cookie, System.Stringn]]…}
Images : {}
InputFields : {}
Links : {}
RawContentLength : 65
RelationLink : {}
Would you be willing to share your working code?
Thanks,
Elliot
Hey Elliot,
Reading your comment made me check my comment and code again. It looks like I mistyped in my XML example and missed the <id> tag - '<class><student_group_ids><id>443</id></student_group_ids></class>'. I see you are also missing that in your example, which is likely the reason you're having trouble.
When I remove the <id> tag and only have the group ID itself (like both of our initial XML examples), I get a 201 response just like you see, and I also see no changes in the class - which makes sense since the tagging isn't formatted correctly.
-William
Hey Elliot,
Reading your comment made me check my comment and code again. It looks like I mistyped in my XML example and missed the <id> tag - '<class><student_group_ids><id>443</id></student_group_ids></class>'. I see you are also missing that in your example, which is likely the reason you're having trouble.
When I remove the <id> tag and only have the group ID itself (like both of our initial XML examples), I get a 201 response just like you see, and I also see no changes in the class - which makes sense since the tagging isn't formatted correctly.
-William
Hi William,
Thanks for that, the missing id tag did the trick. Thankyou so much.