Getting Link to API created Instance.
Here are the steps to get this accomplished.
- Get the API link for the form.
- Get the FormID from the API link. FormID is the one that you will see in the API url after forms/ until the first _ (underscore)
http://app.perfectforms.com/api/forms/3yjHAlggAggA-gwM_API_Add_Instace.asmx?wsdl In this 3yjHAlggAggA-gwM is the FormID.
- First Login to the Application using API login method. On success you will be returned a token, please store that.
- Connect to the Forms API and do a ADD passing in the required fields data and the token that you received on the login success.
- On success from the Add, instance ID is returned. Store that and the token.
- Connect to the API to invoke GetFormInstanceMetaData2, pass in the FormID, token and the instance id. This will return bunch of parameters and the one that will interest you are the link. The value after f= is the instance ID. Below is the Example of what I got.
<GetFormInstanceMetaData2Response xmlns="http://www.PerfectForms.com/API" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<GetFormInstanceMetaData2Result>0</GetFormInstanceMetaData2Result>
<tokenOut>gAgC1BItJpQ0PJwa</tokenOut>
<formInstanceName/>
<formInstanceNumber>1</formInstanceNumber>
<formInstanceGUID>50c59769d2f44701956b99cc183941</formInstanceGUID>
<link>http://app.perfectforms.com/p.aspx?f=od8DhjAgAgAgpAQR</link>
<stageId/>
<stageName/>
<majorVersion>1</majorVersion>
<minorVersion>0</minorVersion>
</GetFormInstanceMetaData2Response>
- Now use that value to pass it to the embedded script to replace the FormID as in the below example.
<script type="text/javascript" src="http://app.perfectforms.com/utils.js"></script><script type="text/javascript">pf_embed("http://app.perfectforms.com/player.aspx", "NjE3OTM=", "f=Br8BggEl", "512", "412", "window"); </script>
This will open the instance that you created.