Skip to main content

Hello there, 
 

I'm trying to figuring out the API and I've got some problems. How do I change questions in the form? I mean remove / rearrange.

I think this endpoint should do that: https://api.videoask.com/forms/{{form_id}} and I can see that it's being called when I change form from VideoAsk app. But I'm not sure how to do it (what parameters should be passed). So let's assume I have form with questions:

<1, 2, 3]

If I want to change it to be:

<3, 2]

What request should I make?

Hi @Timur

This is definitely a more advanced use case, but it’s certainly possible to achieve.

I’ve included some working Python code below for you to use as a reference point.

I’ll also include screenshots of the original videoask and the end result (after the logic transformations have been applied via API).

import requests

# Set your variables
form_id = ""
api_token = ""
organization_id = ""
red_question_id = ""
blue_question_id = ""
yellow_question_id = ""

# Set headers for API calls
headers = {
"authorization": f"Bearer {api_token}",
"organization-id": organization_id
}

# Delete blue step
response = requests.request("DELETE", f"https://api.videoask.com/questions/{blue_question_id}", headers=headers)
print(response.text)

# Connect red step to end screen
response = requests.request("PATCH", f"https://api.videoask.com/questions/{red_question_id}", headers=headers, json={"logic_actions":t{"action":"jump","details":{"to":{"type":"goodbye","value":"default"}},"condition":{"op":"always","vars":"]}}]})
print(response.text)

# Connect yellow step to red step
response = requests.request("PATCH", f"https://api.videoask.com/questions/{yellow_question_id}", headers=headers, json={"logic_actions":t{"action":"jump","details":{"to":{"type":"question","value":f"{red_question_id}"}},"condition":{"op":"always","vars":"]}}]})
print(response.text)

# Connect start step to yellow step
response = requests.request("PATCH", f"https://api.videoask.com/forms/{form_id}", headers=headers, json={"questions":tf"{yellow_question_id}",f"{red_question_id}"]})
print(response.text)

 

Original videoask

 

End result

I hope this helps!


Hi @andrew_videoask! Huge thanks – it is working now!

Although I think there are some rate-limits to DELETE question request? I’m getting ‘internal server error’ when trying to delete more than 2 question in parallel. Not a problem for me – just curious 
 

Also, when creating form through API I’m passing: 

metadata: {
locale: 'en-US'
}

in body – because app is throwing a error in other case (after ~5 seconds upon form opened)

 


Hi @Timur 

Andrew is currently on vacation ⛱️ but we’ve been having a look into this one for you 👀

There shouldn’t be any rate-limiting in place, could you provide the form_id and we can check the error and try to get some more details? 

We’re also going to check the locale needed when creating the form, the engineers think they’ve had some reports on this so will check if it’s a bug.


Reply