Answered

How to open, close and schedule a form through the RESTful API?

  • 18 September 2021
  • 8 replies
  • 420 views

Userlevel 1

Hey,

Seems like you can only change if a form is published or not through the /settings/is_public attribute on a form itself but I can’t find how to open/close a form from the PATCH /forms/{id} endpoint.

Inspecting the web UI, I can see that it’s doing its things using the PUT /forms/{id}/access-scheduling endpoint but this seems hidden from the public RESTful API.

Am I missing something? ¯\_(ツ)_/¯

icon

Best answer by holicamp 21 September 2021, 08:26

View original

8 replies

Userlevel 7
Badge +5

Hello @holicamp , you should be able to use the PATCH request from Create API like this:

curl -X PATCH \
-H "Authorization:Bearer <YOUR-TYPEFORM-PERSONAL-TOKEN>" \
-H "Content-Type: application/json" \
-d '[{"op":"replace","path":"/settings/is_public","value":true}]' \
https://api.typeform.com/forms/<FORM-ID> \
-v

Make sure to use correct token and form ID values. Does this work for you?

Userlevel 1

Hey @mathio thanks for this but I don’t think I explained clearly what I wanted to do.

I knew is_public could be changed from the API. This is basically driving this button within the UI

When is_public is set to true:

When I visit the Typeform, I get a 200 HTTP response and I can access the Typeform no problem.

When is_public is set to false:

When I visit the Typeform, I get a 404 HTTP response and this means my user cannot even access the Typeform.

What I would like to be able to control is this instead:

When a Typeform is open, my users can use the Typeform as usual and I can keep collecting responses.
When a Typeform is closed, my users can see the Typeform is not accepting any more responses and a custom message can be displayed.

Hope this clarifies things for you.

Userlevel 1

I had this answer on Twitter

> Hi Clem 👋

> Sadly this is not possible at the moment.
> This endpoint is not yet documented, but hopefully soon 🤞

https://twitter.com/picsoung/status/1440117740400906242

Badge +5

It comes from @picsoung so you can definitely consider that official 👨🏼‍⚖️ 

Userlevel 1

Hi @picsoung,
is there any documentation or any news according to this request ?

Best regards

We should definitely be able to get the status of form if it is open or not and change it. I don’t understand why this simple feature is missing.

Hi, 

The last answer is 3 months ago, there’s any news about the possibility to publish a form using the API ?

Regards,


Alexis

Any updates about publishing a form using the API?

What about having an attribute into form response indicating the form is currently closed to responses?

Reply