juan.angel

Generating Transaction URL with Python script using API request

0 votes

Good day everyone,

Here in our Security Information area, we're trying to automatize the generation of new URLs with Python. Right now, we're sending the PUT request successfully but the response we get from OneSpan API doesn't show the information we need to continue the process. You can see the code's part we generated to request the API and the HTTP response below:

Code:

r = requests.put('https://idvgl001-dealflo.prod.na1.tid.onespan.cloud/api/secure/transaction/' , data=body_request , headers={'Content-Type': 'application/json','Authorization': 'Bearer ' + token})
print(r)
 
Response:
<Response [200]>
 
Could you indicate us how we can obtain the transaction ID and URL we're generating with this method, please? Maybe, a configuration is missing in the script or something like that.

Thank you in advance.


Approved Answer

Reply to: Generating Transaction URL with Python script using API request

0 votes

I see, could you please try to print the content of the response instead?
print(r.text)

 

Duo

Duo Liang OneSpan Evangelism and Partner Integrations Developer


Reply to: Generating Transaction URL with Python script using API request

0 votes

Hi juan.angel,

 

Thanks for your post!

(1)Could you kindly remove the "/secure/" part from the URL and let us know if that solves the issue?

(2)An expected response should include the transaction ID as well as access tokens for signers, with which you'll be able to build the signing link with below formula:

transaction_url = baseUrl +"/"+ branding_id +"/#/esign/" + transaction.id + "?access_token=" + token.token;

In your case, the final output should look like below:

https://idvgl001-dealflo.prod.na1.tid.onespan.cloud/api/transaction/dealflo/#/esign/{{transactionID}}?access_token={{accessToken}}

 

Duo

 

Duo Liang OneSpan Evangelism and Partner Integrations Developer


Reply to: Generating Transaction URL with Python script using API request

0 votes

Hi Duo, thanks for your response.

I tested the script without the "/secure" part, but i got the same response: <Response [200]>. How you can see, the http response is 200, so the request is working correctly. However, the returned data is limited. Could you indicate me wheter the print function is properly used or it's written in the right way, please?

We appreciate any help you could bring us to solve this issue.


Reply to: Generating Transaction URL with Python script using API request

0 votes

Hi Duo, I already get the response we need. Thank you!


Hello! Looks like you're enjoying the discussion, but haven't signed up for an account.

When you create an account, we remember exactly what you've read, so you always come right back where you left off