Is there an API to read Microsoft forms data

Microsoft

is it possible to read Microsoft forms submitted data . we are exploring concepts and would like to get data of submitted forms using API.

19 Replies

Thank you very much for your ask. This API  feature is in Microsoft Forms feature backlog

Hi 

Is microsoft teams api now available to read form or is it still in progress.

I can see some links 

https://docs.microsoft.com/en-us/kaizala/actions/kasclient/form_response

will it be of any healp to get data from teams forms.

Kindly let me know as soon as possible.

 

Thanks

Suresh

 

@Yong Qiu Is there any news on the Forms API, yet? Or is there an estimated schedule, like H2/2020 or so?

Hi @SureshC997

 

I think your link is for Kaizala and not for Forms or Forms Pro.

 

Cheers.

Kyaw Kyaw Tun

Until the long awaited API is released, a short term workaround could be to use Power Automate (formerly Microsoft Flow) to trigger when a new form is submitted, and to save the results into a SharePoint list, or Excel file, etc and to manipulate the data from there.

 

Power Automate puts some pretty cool options for not only extracting the Forms data but to also initiate other actions that can benefit you (e.g. put the results into a Word doc template and email to someone, etc).

 

Well worth a look!

 

Cheers

Damien  

@Damien Rosario  I wouldn't call using Power Automate a workaround; it's designed for the job!  And the integrations, as you've pointed out, with Email, SharePoint, Forms, Excel etc etc work beautifully.

Rob
Los Gallardos
Microsoft Power Automate Community Super User

Hi @RobElliott 

 

Very true, the capability is there with some extra steps to capture the initial submission, but I reckon my suggestion is a workaround until the API comes out as there'll be more direct ways to get data out of Forms with its release.

 

Cheers

Damien

@Yong Qiu Is Graph able to pull in Forms APIs at this time?  

@RobElliottYou can't do everything with Power Automate. For example, I want to create a single webpage where one can enter multiple names and email addresses. They all should get send a link to a form. At the moment you have to create an excel file with the names and email addresses? That's IT from the 90s :xd:

@helfensdoerfer I never said you could do everything with it and I am often telling people in my company that it can't do this or we need a premium connector for that. But seeing if it can do what you want for a particular task is a reasonable place to start.

 

Rob
Los Gallardos
Microsoft Power Automate Community Super User

@RobElliottYou are completely right! Just venting because Microsoft Forms is such a simple product and every 1 person startup today has an API for everything. Except one of the biggest IT companies in the world...

There now appears to be an API for getting some information from Microsoft Forms at https://forms.office.com/formapi/api. I'm not sure when it was released, and I'm having trouble finding documentation on it, but I can at least pull some information in my browser this way. After going to https://forms.office.com/ to login (which sets a token in the browser), I can then browse to https://forms.office.com/formapi/api to get a list of operations or to a specific operation like https://forms.office.com/formapi/api/forms to get a list of my Forms.

@ProtivitiDan Any more information about this?  I can get JSON responses as you did, but was not successful getting form responses.  Wondering if any documentation has appeared anywhere.

@waltksfc I abandoned my attempts at the time, but looking at it again now I see that I can get info on a specific form with:

https://forms.office.com/formapi/api/forms/{formid}

Then I can get the questions or responses on that form with these:

https://forms.office.com/formapi/api/forms/{formid}/questions
https://forms.office.com/formapi/api/forms/{formid}/responses

 

Get the {formid} from the /forms API call.

 

@ProtivitiDan - thanks for the reply.  Yep - that works.  Successfully retrieved JSON-formatted questions and responses - but only after logging in/authenticating in our O365 tenant.  I can see that the Forms design page is making AJAX calls to the API, but it looks like it's passing some sort of access tokens in the request headers/cookie.  It would be nice if Microsoft would publish some information about this, and allow some kind of persistent access token in the url/path for an API call - as they do when they provide a shared collaboration link.

 

At this point, I've already created a process to ingest the responses from a downloadable Excel sheet, so there's probably no advantage for me to use the API (since I have to be authenticated before it will work).

Thanks again - appreciate you taking the time to respond.

 

@waltksfc I needed the exact same thing, and thanks to you and @ProtivitiDan I was able to figure out the correct path.

 

If you want to make a custom connector for Forms in Flow, you'll need a way to handle authentication.

  1. Make a new app registration in Azure AD
  2. Use https://global.consent.azure-apim.net/redirect as the redirect
  3. Under Certificates & secrets, create a new client secret and save the value somewhere before closing the window because you won't see it ever again
  4. Under API permissions, add a permission. For this you'll want to go to the "APIs my organization uses" tab and find Microsoft Forms. Add it as a Delegated permission if you want the logged in user to only access their own forms in Flow. I haven't tried Application permission for Forms, but I imagine it will grant access to everyone's forms.
  5. If you don't want to have to approve every Delegated permission request, make sure after adding it that you press the "Grant admin consent" button.
  6. Take note of the Application ID.
  7. Open up Flow and create a custom connector using the App you just created.

There are a lot of guides out there for how to make one. However, the relevant fields for this connector to work with Forms are:

  • Host: forms.office.com
  • Base URL: /formapi/api
  • Identity Provider: Azure Active Directory
  • Client id: your App ID from above
  • Client secret: the value of the client secret from above
  • Resource URL: https://forms.office.com
  • Scope: your permissions from above (I used  Forms.Read Responses.Read.All  )

When you make the connector definition, you insert any dynamic parameters in curly brackets in the request URL. For example, to make an action that requests all questions that are on a specific form, you'd use https://forms.office.com/formapi/api/forms/{formId}/questions for the URL and then formId will be a parameter that you'd fill in for the Flow's action.

 

I'm now able to authenticate to make web requests to Forms in a Flow so I know you'll be able to do it, too. Hopefully my little guide helps put you on the correct path! :happyface:

Hello, @ProtivitiDan

 

Do you know where can I find API documentation or any kind of guide?

 

I'm trying to retrieve responses for a specific QuestionId but can't seem to find the combination for the GET request. 

 

Thank you!

Sorry @aura_sun, but I don't know of any official documentation from Microsoft yet. @JR2021 may have one of the best guides to date in the thread above.
Dan