# HTTP Synthetic Monitor API with sha256

**URL:** <https://community.dynatrace.com/t/http-synthetic-monitor-api-with-sha256/51477>\
**Category:** Synthetic Monitoring\
**Tags:** http-monitor, synthetic-monitoring\
**Created:** [May 5, 2025, 9:19am UTC](https://community.dynatrace.com/t/http-synthetic-monitor-api-with-sha256/51477 "2025-05-05T09:19:49Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![H\_THIM](https://avatars.discourse-cdn.com/v4/letter/h/9f8e36/32.png) [@H\_THIM](https://community.dynatrace.com/u/H_THIM)\
**Post date:** [May 5, 2025, 9:19am UTC](https://community.dynatrace.com/t/http-synthetic-monitor-api-with-sha256/51477/1 "2025-05-05T09:19:49Z")

</div>

Hello .

Can someone help to rewrite a part of a python script in Dynatrace Synthetic using pre-script

here is the code of my python script .

Spoilerurl =“[https://endpointhost/parent/R000057/v1/sent/status](https://endpointhost/parent/R000057/v1/sent/status)”  
api\_key = “xaaaaxxxxxaaaaxxxxxaaaazzz”  
secret = “ZxxAAUUaa”  
ts = time.time()  
sign = api\_key+secret+str(timestamp)  
shen256 = hashlib.sha256(sign.encode())  
finalurl = url+“?api\_key=”+api\_key+“&sig=”+shen256.hexdigest()  
headers = {“User-Agent”:“Myapp/Python”}  
response = requests.get(finalurl , headers=headers)

the difficulty is to rewrite the final url with&nbsp; the Epoch&nbsp; in combination with the key and secret .

i tryed many things but still not working .

any idea and help is welcome .

---

<div class="post-metadata">

**Author:** ![AntonPineiro](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/antonpineiro/32/49_2.png) [@AntonPineiro](https://community.dynatrace.com/u/AntonPineiro)\
**Post date:** [May 5, 2025, 11:04am UTC](https://community.dynatrace.com/t/http-synthetic-monitor-api-with-sha256/51477/2 "2025-05-05T11:04:18Z")

</div>

Hi,  
I have just run and URL looks like this:

 ![AntonPineiro_0-1746442941999.png](https://global.discourse-cdn.com/dynatrace/original/1X/587c92506982c6868147dc846fb979bd8795f7fa.png)

```markup
https://endpointhost/parent/R000057/v1/sent/status?api_key=xaaaaxxxxxaaaaxxxxxaaaazzz&sig=03fec1a1e92292b841fdd9c45add64421bfec456dbb871ccd2284cf04695f963

```

I have just changed “timestamp” for “ts” when you create “sign” variable:

```python
sign = api_key+secret+str(ts)

```

Best regards

---

<div class="post-metadata">

**Author:** ![H\_THIM](https://avatars.discourse-cdn.com/v4/letter/h/9f8e36/32.png) [@H\_THIM](https://community.dynatrace.com/u/H_THIM)\
**Post date:** [May 5, 2025, 12:23pm UTC](https://community.dynatrace.com/t/http-synthetic-monitor-api-with-sha256/51477/3 "2025-05-05T12:23:11Z")

</div>

Hello&nbsp;[@AntonPineiro](https://community.dynatrace.com/user/58682)

thanks for the quick reply.

Actually my python script is working well as expected what i want&nbsp; is to do same thing in dynatrace on the HTTP monitor (in the pre-script) ..

what i want is to monitor the response of this request via synthetic monitor (HTTP) .

---

<div class="post-metadata">

**Author:** ![AntonPineiro](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/antonpineiro/32/49_2.png) [@AntonPineiro](https://community.dynatrace.com/u/AntonPineiro)\
**Post date:** [May 5, 2025, 2:43pm UTC](https://community.dynatrace.com/t/http-synthetic-monitor-api-with-sha256/51477/4 "2025-05-05T14:43:50Z")

</div>

Hi,

You need to use JavaScript for this. [This](https://community.dynatrace.com/post/220776) is another use case but maybe it would help you.

Best regards
