SOLVED

Re: Get Forms per Program

Go to solution
Thorsten
Level 4

Get Forms per Program

Hey everyone,

what's the most efficient way to get all forms for a specific program via the API nowadays?

Rgds,

Thorsten

 

2 ACCEPTED SOLUTIONS

Accepted Solutions
SanfordWhiteman
Level 10 - Community Moderator

Re: Get Forms per Program

Browse forms is filterable by folder/program.

View solution in original post

Thorsten
Level 4

Re: Get Forms per Program

Also note to self:

If your forms are within a sub-folder of the program, the call against the program ID

{"id": 71228,"type": "Program"}

will not return "all forms within the program" as - at least for me - it might be intuitively how it works.

 

No, you need to traverse the whole folder structure WITHIN the program first and check for each sub-folder individually to get all forms in x-number of API calls.

 

Now I remember why I initially asked for "efficient"... 😔

View solution in original post

4 REPLIES 4
SanfordWhiteman
Level 10 - Community Moderator

Re: Get Forms per Program

Browse forms is filterable by folder/program.

Thorsten
Level 4

Re: Get Forms per Program

Got it. Thanks Sanford!

 

My confusion came from the fact that this option was not mentioned explicitly on (one part of) the documentation,

Get Forms forms works like other Asset API browse endpoints, and allows optional filtering on statusmaxReturn, and offset. Status can be: approved, approved with draft, or draft.



but rather probably implied by the "works like other Asset API browse endpoints". Plus, I see now that it's mentioned in the API Reference docs. Well, lesson learned - always have to check both sources.

 

Note to my future self: works fine with:

 

{{baseUrl}}/rest/asset/v1/forms.json?folder={"id": 71228,"type": "Program"}

 

 

Again, thanks for the quick feedback!

 

Kind regards,

Thorsten

 

Thorsten
Level 4

Re: Get Forms per Program

Also note to self:

If your forms are within a sub-folder of the program, the call against the program ID

{"id": 71228,"type": "Program"}

will not return "all forms within the program" as - at least for me - it might be intuitively how it works.

 

No, you need to traverse the whole folder structure WITHIN the program first and check for each sub-folder individually to get all forms in x-number of API calls.

 

Now I remember why I initially asked for "efficient"... 😔

SanfordWhiteman
Level 10 - Community Moderator

Re: Get Forms per Program

Oh yeah, that. 🙂