Skip to main content

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? ¯\_(ツ)_/¯

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?


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.


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


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


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?


Hi,

Any news when the endpoint managing the access-scheduling  will be made public ?

Is really better to display a close screen message, something like “Survey campaign closed” or “Survey campaign canceled”  rather than making the link invalid via is is_public  attribute.

Thanks in advance.

Honestly like ​@holicamp  I tried to look what the UI is using via the PUT https://admin.typeform.com/bff/bob-the-builder/forms/bformid]/access-scheduling and seems that is using internally an endpoint which, after  some try and  guess 🙂 is the  one below

curl --location --request PUT 'https://api.typeform.com/forms/pformid]/submission-rules' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer tfp_****************' \
--data '{
"closing_rules": "
{
"type": "manual"
}
],
"screens":
{
"ref": "custom-close-screen",
"enabled": true,
"title": "Survey campain is closed!",
"properties": {
"description": "Thank you for your interest in our survey! This campaign is now closed, and we’re no longer accepting responses. We greatly appreciate your time and feedback. Stay tuned for updates on how your input is helping us improve and grow!"
}
}
]
}'

seems to work, but I would like to be sure this endpoint will not suddenly changing as is not publicly maintained

 


Reply