Good Morning all
I have been searching in the docs and tried many things for a considerable amount ot time, but I do need help now.
we have the following url:
http://api.mycompany.com/web/impex/usageProfileExportAPI?contentProviderId=1234&usageProfileId=1234&fileFormat=JSON&ss.exp=20221022151011&ss.sig=9zz1b2e8f75004
I am trying to setup a rule that
if usageProfileExportAPI and usageProfileId is present in the url
then send the traffic to a pool
if it is not present
then send it to a black hole
I have tried:
$AllowExportAPI = http.getPath(); if( string.contains( $AllowExportAPI, "usageProfileExportAPI" ) ) { if( string.contains( $AllowExportAPI, "usageProfileId" ) ) { pool.use( "STG api.stg 10090" ); } else { http.redirect( "https://www.mycompany.com" ); } } else { pool.use( "STG api.stg 10090" ); }
and
$AllowExportAPI = http.getPath(); if( string.contains( $AllowExportAPI, "usageProfileExportAPI" ) ) { $AllowUsageProfile = http.getPath(); if( string.contains( $AllowUsageProfile, "usageProfileId" ) ) { pool.use( "STG api.stg 10090" ); } else { http.redirect( "https://www.mycompany.com" ); } } else { pool.use( "STG api.stg 10090" ); }
and
$AllowExportAPI = http.getPath(); if( string.contains( $AllowExportAPI, "usageProfileExportAPI" ) ) { $AllowUsageProfile = http.getPath(); if( string.contains( $AllowUsageProfile, "usageProfileId" ) ) { http.redirect( "https://www.mycompany.com" ); } else { pool.use( "STG api.stg 10090" ); } } else { pool.use( "STG api.stg 10090" ); }
and
$AllowExportAPI = http.getPath(); if( string.contains( $AllowExportAPI, "usageProfileExportAPI" ) && string.contains( $AllowExportAPI, "usageProfileId" ) ) { http.redirect( "https://www.mycompany.com/" ); } else { pool.use( "STG api.stg 10090" ); }
and
$AllowExportAPI = http.getPath(); if( string.contains( $AllowExportAPI, "usageProfileExportAPI" ) & string.contains( $AllowExportAPI, "usageProfileId" ) ) { http.redirect( "https://www.mycompany.com/" ); } else { pool.use( "STG api.stg 10090" ); }
and lastly:
$AllowExportAPI = http.getPath(); if( string.contains( $AllowExportAPI, "usageProfileExportAPI" )) { http.redirect( "https://www.mycompany.com/" ); } else { pool.use( "STG api.stg 10090" ); } if (!string.contains( $AllowExportAPI, "usageProfileId" )) { http.redirect( "https://www.mycompany.com/" ); }
None of these worked so for now I am using:
$AllowExportAPI = http.getPath(); if( string.contains( $AllowExportAPI, "usageProfileExportAPI" ) ) { http.redirect( "https://www.mycompany.com/" ); }
until I can get this sorted.
Can anybody please help with this?
Thank you
Kobus
Solved! Go to Solution.
I have also tried this:
$AllowExportAPI = http.getPath(); $usageProfileExportAPI = string.contains( $AllowExportAPI, "usageProfileExportAPI" ); $usageProfileId = string.contains( $AllowExportAPI, "usageProfileId" ); if( $usageProfileExportAPI == 1 & $usageProfileId == 1 ) { pool.use( "STG cds1.stg 10090" ); } else { http.redirect( "https://www.yospace.com/" ); }
Hello, it looks like you want to look for "usageProfileExportAPI" in the URL path, and for "usageProfileId" in the query string, following the URL?
So something like this might work:
# What is the client asking for? $path = http.getPath(); # ... and the QueryString $query = http.getQueryString(); # Test each part separately if( string.contains( $path, "usageProfileExportAPI" ) ) { if( string.contains( $query, "usageProfileId" ) ) { ... } }
Couple of useful docs:
I will also move this post to the Pulse vADC forum