cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

loading IP mapping

kickme
Visitor

hello

When i load ip mapping in dynatrace (app web/system/...)  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.

 

 

8 REPLIES 8

AntonPineiro
DynaMight Guru
DynaMight Guru

Hi,

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

Best regards

❤️ Emacs ❤️ Vim ❤️ Bash ❤️ Perl

kickme
Visitor

Hello

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

kickme_0-1733387404393.png

location just added appear in list.

 

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

 

 

 

Hi,

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

Best regards

❤️ Emacs ❤️ Vim ❤️ Bash ❤️ Perl

Hi @kickme 

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

BR,

Peter

kickme
Visitor

Hello

 

This part of my script

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

 

$body = @"
{
    `"ipAddressMappingRules`": [
        {
            `"ipAddressMappingLocation`": {
                `"city`": `"$ville`",
                `"countryCode`": `"$countryCode`",
                `"latitude`": $latitude,
                `"longitude`": $longitude
            },
            `"ipAddressRange`": {
                `"address`": `"$VLAN_debut`",
                `"addressTo`": `"$VLAN_fin`",
                `"subnetMask`": `"`"
            }
        }
    ]
}
"@

$response = Invoke-RestMethod 'https://{environmentid}.live.dynatrace.com/api/config/v1/geographicRegions/ipAddressMappings' -Method 'PUT' -Headers $headers -Body $body
 
I thought issue is in my code so i tried with postman
exactly 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  

kickme
Visitor

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

Hi @kickme 

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

Keep up the good work.

BR,

Peter

kickme
Visitor

HI

Loading IP mapping is "one shot" mode => 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  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.

 

Featured Posts