Forum Discussion
BATCH API Issue when connecting to an iSAMS (Education D'Base).
Hi everyone
I've been spending my Sunday evening reviewing APIs and data coming out of an iSAMS d'base (for those not familiar - it's a school information management system holding lots of student information and records)
So, there are some easy to run APIs that do not require filters... and some that are not quite so easy to figure out.
I have been attempting to connect to this API (server and API key omitted):
let
Source = Xml.Tables(
Web.Contents(
"https://server.hostedinthe.cloud/api/batch/1.0/xml.ashx?apiKey=XXXYYYZZZ-111222333",
[
Headers = [#"Content-Type"="application/xml"],
Content = Text.ToBinary("
<Filters>
<MethodsToRun>
<Method>PupilRegisters_GetSENRegister</Method>
</MethodsToRun>
<SENRegister>
<systemStatusesToInclude>1</systemStatusesToInclude>
</SENRegister>
</Filters>
")
]
)
)
in
Source
Now, as I am not an expert in these matters, I have resorted to the d'base KB, which is unfortunately behind a password.
When I build the API key, I select the Module, and then the specific Root Nodes that are made available through that API key.
The one I am interested in is the SEN Register entity, which will help me highlight students who have a range of special educational needs - this ranges from not speaking English to those with more complex and specific requirements. (Below I snipped out of the support doc's)
| Module | Root Node | Entity Node | Filter Required? | Filter By? | Method Name | |
| <PupilRegisters> | <FreeSchoolMeals> | <FreeSchoolMeal> | Yes | Students | PupilRegisters_GetFreeSchoolMeals | C2338057-D2E8-4EF5-A5FB-E04989B430FC |
| <GiftedAndTalentedRegister> | <Register> | Yes | Students | PupilRegisters_GetGiftedAndTalentedRegister | EB0F5D59-F9B4-4A1F-92EE-368736F8CA52 | |
| <SENLessons> | <Lesson> | Yes | Students | PupilRegisters_GetSENLessons | 0B9EF2BC-C658-4DAF-B676-9BD980C9C134 | |
| <SENRegister> | <Register> | Yesv | Students | PupilRegisters_GetSENRegister | 7300D746-BFB5-4FD9-A4A2-5466B5529104 | |
| <SENTypes> | <Type> | Yes | Students | PupilRegisters_GetSENTypes | EA487EDF-DD93-4ACB-B3DB-D8123FF31DA4 |
Using the code I posted in the above code window I get an error that I cannot seem to get around. This is frustrating me as I was able to figure out how to look at attendance data with the following (apologies for the end, that was from later processing):
let
Source = Xml.Tables(
Web.Contents(
"https://studentdbase.cloud/api/batch/1.0/xml.ashx?apiKey=1234567890",
[
Headers = [#"Content-Type"="application/xml"],
Content = Text.ToBinary("
<Filters>
<MethodsToRun>
<Method>Registration_GetRegistrationStatus</Method>
</MethodsToRun>
<RegistrationStatuses>
<RegistrationStatus StartDate='2023-01-03' EndDate='2023-05-26' />
</RegistrationStatuses>
</Filters>
")
]
)
),
Table = Source{0}[Table],
#"Expanded Table" = Table.ExpandTableColumn(Table, "Table", {"Name", "Table"}, {"Table.Name", "Table.Table"}),
#"Expanded Table.Table" = Table.ExpandTableColumn(#"Expanded Table", "Table.Table", {"PupilId", "Registered", "RegistrationDateTime", "Late", "MinutesLate", "Alert", "ParentNotificationSent", "Author", "LastUpdated", "PeriodId", "Attribute:Id", "Code", "Reason"}, {"Table.Table.PupilId", "Table.Table.Registered", "Table.Table.RegistrationDateTime", "Table.Table.Late", "Table.Table.MinutesLate", "Table.Table.Alert", "Table.Table.ParentNotificationSent", "Table.Table.Author", "Table.Table.LastUpdated", "Table.Table.PeriodId", "Table.Table.Attribute:Id", "Table.Table.Code", "Table.Table.Reason"})
in
#"Expanded Table.Table"
Any obvious ideas as to where I am going wrong? My first thought is about the status of the student in the API request. This should be, I believe, -1= former student, 0 = applicant and 1 = current student.
1 Reply
- Syndicate_AdminAdministrator
Looks like some code got left out:
let Source = Xml.Tables( Web.Contents( "https://studentdb.cloud/api/batch/1.0/xml.ashx?apiKey=11122223333", [ Headers = [#"Content-Type"="application/xml"], Content = Text.ToBinary(" ") ] ) ),PupilRegisters_GetSENRegister