# Loading IP mapping

**URL:** <https://community.dynatrace.com/t/loading-ip-mapping/49204>\
**Category:** Dynatrace API\
**Tags:** dynatrace-api\
**Created:** [December 4, 2024, 5:14pm UTC](https://community.dynatrace.com/t/loading-ip-mapping/49204 "2024-12-04T17:14:18Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![kickme](https://avatars.discourse-cdn.com/v4/letter/k/b9bd4f/32.png) [@kickme](https://community.dynatrace.com/u/kickme)\
**Post date:** [December 4, 2024, 5:14pm UTC](https://community.dynatrace.com/t/loading-ip-mapping/49204/1 "2024-12-04T17:14:18Z")

</div>

hello

When i load ip mapping in dynatrace (app web/system/…)&nbsp; all works fine. i can see all data manually added.

With API, it works but i only add in dynatrace the data of last call (all previous data are deleted after each call)

Idea of mistake ?

Thanks.

---

<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:** [December 5, 2024, 7:50am UTC](https://community.dynatrace.com/t/loading-ip-mapping/49204/2 "2024-12-05T07:50:32Z")

</div>

Hi,

I cannot understand you. Can you explain a little more or some screenshot?

Best regards

---

<div class="post-metadata">

**Author:** ![kickme](https://avatars.discourse-cdn.com/v4/letter/k/b9bd4f/32.png) [@kickme](https://community.dynatrace.com/u/kickme)\
**Post date:** [December 5, 2024, 8:32am UTC](https://community.dynatrace.com/t/loading-ip-mapping/49204/3 "2024-12-05T08:32:53Z")

</div>

Hello

when i add manually in dynatrace ip mapping, all is ok

 ![kickme_0-1733387404393.png](https://global.discourse-cdn.com/dynatrace/original/3X/b/8/b8a6cdc3fd51db96eaf86bba3dc76eb652334962.png)

location just added appear in list.

But if i add a location with my script or postman,&nbsp;all existing entries are deleted, and only the last added one appears

---

<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:** [December 5, 2024, 5:15pm UTC](https://community.dynatrace.com/t/loading-ip-mapping/49204/4 "2024-12-05T17:15:10Z")

</div>

Hi,

Strange, can you share your API calls using postman or in the script?

Best regards

---

<div class="post-metadata">

**Author:** ![Peter\_Youssef](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/peter_youssef/32/14668_2.png) [@Peter\_Youssef](https://community.dynatrace.com/u/Peter_Youssef)\
**Post date:** [December 6, 2024, 1:35pm UTC](https://community.dynatrace.com/t/loading-ip-mapping/49204/5 "2024-12-06T13:35:21Z")

</div>

Hi&nbsp;[@kickme](https://community.dynatrace.com/user/78387)

You can check the API && assigned token scopes and access privileges.

BR,

Peter

---

<div class="post-metadata">

**Author:** ![kickme](https://avatars.discourse-cdn.com/v4/letter/k/b9bd4f/32.png) [@kickme](https://community.dynatrace.com/u/kickme)\
**Post date:** [December 6, 2024, 2:49pm UTC](https://community.dynatrace.com/t/loading-ip-mapping/49204/6 "2024-12-06T14:49:40Z")

</div>

Hello

This part of my script

those lines are in a loop (with my data in sqlserver)

$body = @“{&nbsp; &nbsp; `“ipAddressMappingRules`”: [&nbsp; &nbsp; &nbsp; &nbsp; {&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; `“ipAddressMappingLocation`”: {&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; `“city`”: `”$ville`“,&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; `“countryCode`”: `”$countryCode`“,&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; `“latitude`”: $latitude,&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; `“longitude`”: $longitude&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; },&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; `“ipAddressRange`”: {&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; `“address`”: `”$VLAN_debut`“,&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; `“addressTo`”: `”$VLAN_fin`“,&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; `“subnetMask`”: `”`"&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }&nbsp; &nbsp; &nbsp; &nbsp; }&nbsp; &nbsp;]}"@  
$response = Invoke-RestMethod ‘https://{environmentid}.live.dynatrace.com/api/config/v1/geographicRegions/ipAddressMappings’ -Method ‘PUT’ -Headers $headers -Body $bodyI thought issue is in my code so i tried with postmanexactly same issue with postman.My API account has all option checked (i started by check that)if issue was with account, i can’t PUT a all, not only one

---

<div class="post-metadata">

**Author:** ![kickme](https://avatars.discourse-cdn.com/v4/letter/k/b9bd4f/32.png) [@kickme](https://community.dynatrace.com/u/kickme)\
**Post date:** [December 9, 2024, 3:26pm UTC](https://community.dynatrace.com/t/loading-ip-mapping/49204/7 "2024-12-09T15:26:38Z")

</div>

if i put 2 locations on the same API call : i found them in dynatrace.

---

<div class="post-metadata">

**Author:** ![Peter\_Youssef](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/peter_youssef/32/14668_2.png) [@Peter\_Youssef](https://community.dynatrace.com/u/Peter_Youssef)\
**Post date:** [December 10, 2024, 5:18am UTC](https://community.dynatrace.com/t/loading-ip-mapping/49204/8 "2024-12-10T05:18:50Z")

</div>

Hi&nbsp;[@kickme](https://community.dynatrace.com/user/78387)

Definitely, whatever configured through API or UI can be triggered.

Keep up the good work.

BR,

Peter

---

<div class="post-metadata">

**Author:** ![kickme](https://avatars.discourse-cdn.com/v4/letter/k/b9bd4f/32.png) [@kickme](https://community.dynatrace.com/u/kickme)\
**Post date:** [December 18, 2024, 9:32am UTC](https://community.dynatrace.com/t/loading-ip-mapping/49204/9 "2024-12-18T09:32:48Z")

</div>

HI

Loading IP mapping is “one shot” mode =\>&nbsp;All VLAN must loaded on only one call.

My script made a loop and an API call on each row returned by database.

With this method&nbsp; each API call delete existing mapping in dynatrace before insert new one.

I change to build a big payload to make only one api call.

Now it s ok.
