Archive

Archive for the ‘Uncategorized’ Category

Car License Plate #API support for #Lithuania

Introducing support for Lithuania via our Car License Plate API

Are you looking to seamlessly integrate detailed vehicle information into your applications? Welcome to Numerio Zenklai API, Lithuania’s latest and most advanced car license plate API. This service is designed to provide comprehensive vehicle details, enhancing your ability to offer top-tier services in the automotive, insurance, and related industries.

Why Choose Numerio Zenklai API?

Numerio Zenklai API offers a robust solution for retrieving detailed information about vehicles registered in Lithuania. With a simple request to the /CheckLithuania endpoint, you can obtain critical data, including the vehicle’s make, model, age, engine size, VIN, insurer, and a representative image.

Key Features

1. Comprehensive Vehicle Data:
Access a rich set of details about any Lithuanian-registered vehicle. For example, a query on the registration number “NAO075” returns the following data:

  • Make and Model: Volkswagen Crafter
  • Registration Year: 2006
  • Engine Size: 2461 cc
  • VIN: WV1ZZZ2EZE6017394
  • Fuel Type: Diesel
  • Insurance Company: ERGO INSURANCE SE LIETUVOS FILIALAS
  • Vehicle Type: Lorry
  • Body Type: Bus
  • Representative Image: Image URL

2. Simple and Fast Integration:
Our API is designed for quick integration, ensuring you can start leveraging vehicle data with minimal setup. Here’s a sample JSON response for an easy understanding of the data format:

{
"Description": "VOLKSWAGEN CRAFTER",
"RegistrationYear": "2006",
"CarMake": {
"CurrentTextValue": "VOLKSWAGEN"
},
"CarModel": {
"CurrentTextValue": "CRAFTER"
},
"MakeDescription": {
"CurrentTextValue": "VOLKSWAGEN"
},
"ModelDescription": {
"CurrentTextValue": "CRAFTER"
},
"EngineSize": {
"CurrentTextValue": "2461"
},
"VIN": "WV1ZZZ2EZE6017394",
"FuelType": "Diesel",
"InsuranceCompany": "ERGO INSURANCE SE LIETUVOS FILIALAS",
"InsuranceCompanyNumber": "ACB 1798038:8192689",
"VehicleType": "LORRY",
"Body": "Bus",
"ImageUrl": "http://www.numeriozenklaiapi.lt/image.aspx/@Vk9MS1NXQUdFTiBDUkFGVEVS"
}

3. Reliable and Up-to-Date Information:
Our API ensures that you always receive the most current and accurate data directly from official sources, making it a reliable tool for various applications.

Use Cases

  • Automotive Industry: Quickly verify vehicle details for sales, maintenance, and servicing.
  • Insurance Companies: Validate vehicle information for underwriting and claims processing.
  • Fleet Management: Monitor and manage a fleet of vehicles efficiently with detailed data.
  • Law Enforcement: Access critical vehicle information swiftly for enforcement and regulatory purposes.

Getting Started

To begin using Numerio Zenklai API, visit our website and check out our comprehensive documentation. Our user-friendly interface and extensive support resources make it easy for developers to integrate the API into their existing systems.

Conclusion

Numerio Zenklai API is your go-to solution for accessing detailed vehicle information in Lithuania. Whether you’re in the automotive industry, insurance sector, or any field that requires precise vehicle data, our API provides the tools you need to enhance your services and streamline your operations.

Experience the power of reliable vehicle information with Numerio Zenklai API today. Visit Numerio Zenklai API to learn more and start integrating now!

Find #Azure Functions still using the in-process model in #Azure

If you got the following email from Microsoft Azure:

Migrate your .NET apps in Azure Functions to the isolated worker model by 10 November 2026
You’re receiving this email because you use the in-process model with .NET applications in Azure Functions.

Beginning 10 November 2026, the in-process model for .NET apps in Azure Functions will no longer be supported. To ensure that your apps that use this model continue being supported, you’ll need to transition to the isolated worker model by that date.

You may still use your .NET apps with the in-process model beyond 10 November 2026, but they will no longer receive security and feature updates from Microsoft.

The isolated worker model offers all the same functionality as the in-process model, plus improvements such as:

Full control of the dependency chain.
Isolation from platform lifecycle activities.
The ability to target Standard Term Support (STS) versions of .NET.
Required action
To ensure your .NET apps in Azure Functions continue to receive support, migrate to the isolated worker model by 10 November 2026.

Here is a script in both Powershell and Dos (Batch), to check which functions are using the in-process model; (Using the azure CLI for Windows)

This script logs into Azure, sets the subscription, lists the function apps, and checks the settings to identify which apps are using the in-process model for .NET:

powershellCopy code# Log in to Azure
az login

# Set your subscription (replace with your subscription ID)
$subscriptionId = "<your-subscription-id>"
az account set --subscription $subscriptionId

# List all function apps in the subscription
$functionApps = az functionapp list --query "[].{name:name, resourceGroup:resourceGroup}" --output tsv

Write-Output "Function Apps using in-process model for .NET:"
Write-Output "--------------------------------------------"

# Loop through each function app
$functionApps | ForEach-Object {
    $name, $resourceGroup = $_ -split "`t"

    # Get the app settings for the function app
    $appSettings = az functionapp config appsettings list --name $name --resource-group $resourceGroup --query "[?name=='FUNCTIONS_WORKER_RUNTIME' || name=='FUNCTIONS_EXTENSION_VERSION']" | ConvertFrom-Json

    # Check if the function app is using the in-process model
    $isInProcess = $appSettings | Where-Object { $_.name -eq 'FUNCTIONS_WORKER_RUNTIME' -and $_.value -eq 'dotnet' }

    if ($isInProcess) {
        Write-Output "Function App Name: $name, Resource Group: $resourceGroup"
    }
}

To run this script:

  1. Open PowerShell on your Windows machine.
  2. Copy and paste the script into the PowerShell window (or save it as a .ps1 file and run it).
  3. Replace <your-subscription-id> with your actual Azure subscription ID.

This script will list all function apps that are using the in-process model for .NET, helping you identify which ones need to be migrated to the isolated worker model.

If you prefer a DOS batch script, it’s a bit more complex due to the limitations of batch scripting, but here’s an attempt to do something similar using basic batch commands and PowerShell for processing:

batchCopy code@echo off

REM Log in to Azure (this will open a browser for authentication)
az login

REM Set your subscription (replace with your subscription ID)
set SUBSCRIPTION_ID=<your-subscription-id>
az account set --subscription %SUBSCRIPTION_ID%

REM List all function apps in the subscription and save to a temporary file
az functionapp list --query "[].{name:name, resourceGroup:resourceGroup}" --output tsv > functionapps.txt

echo Function Apps using in-process model for .NET:
echo --------------------------------------------

REM Loop through each function app
for /F "tokens=1,2" %%A in (functionapps.txt) do (
    set NAME=%%A
    set RESOURCE_GROUP=%%B

    REM Get the app settings for the function app and save to a temporary file
    az functionapp config appsettings list --name %NAME% --resource-group %RESOURCE_GROUP% --query "[?name=='FUNCTIONS_WORKER_RUNTIME' || name=='FUNCTIONS_EXTENSION_VERSION']" --output json > appsettings.json

    REM Use PowerShell to check if the function app is using the in-process model
    powershell -Command "
        $appSettings = Get-Content 'appsettings.json' | ConvertFrom-Json;
        $isInProcess = $appSettings | Where-Object { $_.name -eq 'FUNCTIONS_WORKER_RUNTIME' -and $_.value -eq 'dotnet' };
        if ($isInProcess) { Write-Output 'Function App Name: %NAME%, Resource Group: %RESOURCE_GROUP%' }
    "
)

REM Clean up temporary files
del functionapps.txt
del appsettings.json

To run this batch script:

  1. Open a text editor and copy the script into it.
  2. Save the file with a .bat extension, for example, checkFunctionApps.bat.
  3. Run the batch file from the command prompt.

This script uses az commands to log in, set the subscription, and list the function apps. It then checks each app’s settings using PowerShell to determine if it is using the in-process model for .NET.

Updating #AWS Lambda #Python version

If, like me, you have an old Lambda function running Python 3.8, you may have got this email from AWS today;


We are contacting you as we have identified that your AWS Account currently has one or more AWS Lambda functions using the Python 3.8 runtime.

We are ending support for Python 3.8 in Lambda on October 14, 2024. This follows Python 3.8 End-Of-Life (EOL) which is scheduled for October, 2024 [1].

As described in the Lambda runtime support policy [2], end of support for language runtimes in Lambda happens in several stages. Starting on October 14, 2024, Lambda will no longer apply security patches and other updates to the Python 3.8 runtime used by Lambda functions, and functions using Python 3.8 will no longer be eligible for technical support. Also, Python 3.8 will no longer be available in the AWS Console, although you can still create and update functions that use Python 3.8 via AWS CloudFormation, the AWS CLI, AWS SAM, or other tools. Starting February 28, 2025, you will no longer be able to create new Lambda functions using the Python 3.8 runtime. Starting March 31, 2025, you will no longer be able to update existing functions using the Python 3.8 runtime.

So, the first thing, is to find which lambda functions are affected, and this, I wrote a Windows Batch script as follows;

@echo off

set regions=us-east-1 us-east-2 us-west-1 us-west-2 ap-south-1 ap-northeast-1 ap-northeast-2 ap-southeast-1 ap-southeast-2 ca-central-1 eu-central-1 eu-west-1 eu-west-2 eu-west-3 sa-east-1

for %%r in (%regions%) do (
    echo Listing Lambda functions in %%r region:
    aws lambda list-functions --region %%r --output text --query "Functions[?Runtime=='python3.8'].FunctionArn"
    echo -----------------------------------------
)

Then, once I listed all the functions, it’s a matter of going to each one in the AWS Lambda console, scrolling down on the “Code” tab, to change the runtime;

To change the runtime
  1. Open the Functions page of the Lambda console.
  2. Choose the function to update and choose the Code tab.
  3. Scroll down to the Runtime settings section, which is under the code editor.
  4. Choose Edit.
    1. For Runtime, select the runtime identifier.
    2. For Handler, specify file name and handler for your function.
    3. For Architecture, choose the instruction set architecture to use for your function.
  5. Choose Save.

License plate lookup #API now in #Kazakhstan

If your business is in the Automotive trade, and operates in, or with partners in Kazahkstan, it can be useful to be able to determine details of a vehicle based on the license plate of that car, automatically. This API now does that; Which you can find at avtokolik.kz

Car registration plates in Kazakhstan use the /CheckKazakhstan endpoint and returns the
following information:
● Make / Model
● Age
● Engine Size
● Colour
● Region
● Representative image
Sample Registration Number:
860AMZ17
Sample Json:


{
"Description": "OPEL VECTRA",
"RegistrationYear": "1998",
"CarMake": {
"CurrentTextValue": "OPEL"
},
"CarModel": {
"CurrentTextValue": "VECTRA"
},
"MakeDescription": {
"CurrentTextValue": "OPEL"
},
"ModelDescription": {
"CurrentTextValue": "VECTRA"
},
"Colour": "БЕЛЫЙ",
126
"EngineSize": "1598",
"Region": "Jetisu Region",
"ImageUrl": "https://avtokolik.kz/image.aspx/@T1BFTCBWRUNUUkE="
}
  1. Make/Model: Instantly identify the brand and model of the vehicle. For instance, the sample plate “860AMZ17” reveals an Opel Vectra.
  2. Age: Gain insight into the vehicle’s registration year. In our example, the Opel Vectra was registered in 1998.
  3. Engine Size: Know the power under the hood with details about engine size. The Opel Vectra comes equipped with a 1598 cc engine.
  4. Colour: Discover the vehicle’s exterior color. In this case, the Opel Vectra is white (“БЕЛЫЙ”).
  5. Region: Understand the region where the vehicle is registered. The Opel Vectra in our example is registered in the Jetisu Region.
  6. Representative Image: Visualize the vehicle with a representative image. Simply follow the provided URL to see how the Opel Vectra looks.

Utilizing this endpoint not only satisfies curiosity about vehicles on the road but also offers practical insights for various purposes, from verifying vehicle details before purchasing to conducting research on vehicle demographics in different regions of Kazakhstan.

With this accessible tool, individuals and businesses can make informed decisions, whether it’s for personal use, insurance purposes, or market analysis. Embrace the power of technology to unlock a wealth of information hidden within Kazakhstan’s car registration plates.

Categories: Uncategorized Tags: , , , ,

Car Registration #API now available in #Switzerland


Introducing KennzeichenAPI:
Your Ultimate Swiss License Plate Lookup Tool

Whether you’re a curious car enthusiast, an insurance agent, or law enforcement personnel, having access to accurate and comprehensive vehicle information can be invaluable. Enter KennzeichenAPI, a groundbreaking new tool that brings clarity to the world of Swiss car registration plates.

Understanding Swiss License Plates

Switzerland boasts a unique system for car registration plates, each carrying a wealth of information about the vehicle it belongs to. From the make and model to technical specifications and even representative images, Swiss license plates hold the key to unlocking a vehicle’s history and characteristics.

Introducing KennzeichenAPI

KennzeichenAPI is a powerful API (Application Programming Interface) designed specifically to decode Swiss license plates effortlessly. With its user-friendly interface and robust functionality, KennzeichenAPI offers a seamless solution for retrieving detailed information about vehicles registered in Switzerland.

Features

1. Make and Model

Get instant access to the make and model of a vehicle, providing valuable insights into its brand and design.

2. Age

Discover the registration year and month of the vehicle, shedding light on its age and potentially its usage history.

3. Transmission and Fuel Type

Learn about the transmission system and fuel type of the vehicle, crucial details for both enthusiasts and professionals alike.

4. Doors and Body

Understand the number of doors and the body type of the vehicle, offering a glimpse into its structural design.

5. Engine Type and Size

Explore the engine specifications, including type and size, essential for evaluating performance and efficiency.

6. Euro Type Code

Access information about the Euro Type Code, providing insights into the vehicle’s compliance with European emissions standards.

7. Representative Image

Visualize the vehicle with a representative image, enhancing the overall user experience and facilitating identification.

How It Works

Using KennzeichenAPI is simple and straightforward. With just a license plate number, users can query the API and receive a JSON response containing all relevant information about the corresponding vehicle. Let’s take a look at a sample response:

jsonCopy code{
  "Description": "Honda CR-Z",
  "Variant": "CR-Z 1.5i Hybrid GT Coupé - 3 doors - 114 HP - Manuell - 35100 Fr.",
  "RegistrationYear": 2012,
  "RegistrationMonth": 9,
  "CarMake": {
    "CurrentTextValue": "Honda"
  },
  "CarModel": {
    "CurrentTextValue": "CR-Z"
  },
  "Transmission": "Manual",
  "EngineSize": "1497",
  "Power": "84",
  "FuelType": "Benzin / Elektrisch",
  "Doors": "0",
  "Body": "Limousine",
  "EngineType": "LEA1",
  "TypeCertificate": "1HA341",
  "EuroTypeCode": "e11*2007/46-79/2009*0100",
  "Co2": "117",
  "Region": "Aargau",
  "ImageUrl": "http://kennzeichenapi.ch/image.aspx/@SG9uZGEgQ1ItWg=="
}

Example Usage

Let’s say you come across a Swiss license plate with the registration number “AG364769.” By making a simple API call to the /CheckSwitzerland endpoint with this license plate number, you can retrieve comprehensive information about the corresponding vehicle, including its make, model, age, transmission, fuel type, and much more.

import requests

license_plate = "AG364769"
api_url = f"https://www.kennzeichenapi.ch/api/reg.asmx/CheckSwitzerland?licensePlate={license_plate}"

response = requests.get(api_url)
data = response.json()

print(data)

With KennzeichenAPI, unlocking the mysteries behind Swiss license plates has never been easier. Whether you’re conducting research, verifying vehicle details, or satisfying your curiosity, KennzeichenAPI empowers you with the information you need, right when you need it.

Get Started Today!

Ready to explore the world of Swiss license plates like never before? Visit KennzeichenAPI today and start harnessing the power of comprehensive vehicle information at your fingertips. Unlock the potential of Swiss license plates with KennzeichenAPI – your ultimate license plate lookup tool!

Car Registration Search #API now available in #Oman

Unveiling the Oman Car Registration API: Unlocking Vehicle Details with a License Plate

Discovering the Secrets Behind Oman’s Vehicle Market

Oman, a country known for its rich cultural heritage and breathtaking landscapes, is also home to a diverse and vibrant automobile market. With a growing economy and an increasing number of vehicles on the roads, there arises a need for a reliable and efficient solution to retrieve essential information about these cars. Introducing the Oman Car Registration API, a groundbreaking tool designed to look up vehicle details based on license plate numbers, providing a seamless experience for both individuals and businesses.

The Omani Car Market: A Glimpse

Oman boasts a diverse car market, with a mix of local and international brands gracing its roads. The country’s love for automobiles is evident in the variety of vehicles, ranging from sleek sedans to rugged off-road vehicles. As the number of registered vehicles continues to rise, there arises a demand for a convenient way to access crucial information about these cars swiftly and accurately.

Oman Car Registration API: Your Gateway to Vehicle Details

Website: http://om.carregistrationapi.com

The Oman Car Registration API provides a powerful and user-friendly solution for retrieving comprehensive vehicle information based on license plate numbers. By utilizing the /CheckOman endpoint, users can access a plethora of details, including:

  • Make / Model: Uncover the brand and specific model of the vehicle.
  • Age: Determine the registration year, providing insights into the car’s lifespan.
  • Colour: Identify the color of the car, adding an extra layer of detail.
  • VIN (Vehicle Identification Number): Retrieve the unique code that distinguishes each vehicle.
  • Engine Number: Access the specific identification code for the car’s engine.
  • Insurer: Learn about the insurance provider associated with the vehicle.
  • Insurance Expiry: Stay informed about the insurance validity, ensuring compliance with regulations.
  • Representative Image: Visualize the vehicle with a representative image for better recognition.

A Glimpse into the Data

To demonstrate the capabilities of the Oman Car Registration API, consider the following sample registration number:

Sample Registration Number: 69385H

Sample JSON Output:

{
"Description": "NISSAN SUNNY",
"RegistrationYear": "2023",
"CarMake": { "CurrentTextValue": "NISSAN" },
"CarModel": { "CurrentTextValue": "SUNNY" },
"VIN": "MDHBN7AD1KG646954",
"Colour": "WHITE",
"EngineNumber": "HR15-752304G",
"InsuranceExpire": "04/01/2024",
"InsuranceCompany": "Oman United Insurance Company",
"ImageUrl": "http://om.carregistrationapi.com/image.aspx/@TklTU0FOIFNVTk5Z"
}

This sample output showcases the detailed information available, from the vehicle’s make and model to its insurance details, providing a comprehensive overview for users.

How to Get Started

Using the Oman Car Registration API is simple. Visit http://om.carregistrationapi.com and explore the potential of unlocking valuable vehicle information effortlessly.

Whether you are a car enthusiast seeking details about a specific model or an insurance professional verifying policy information, the Oman Car Registration API is your go-to solution. Embrace the power of data and elevate your understanding of Oman’s dynamic car market with this cutting-edge tool.

Verify an Emirates ID via a Free #API

Using RapidAPI – on this page: https://rapidapi.com/fvetroo5ri/api/verify-emirates-id

There is a free API that returns the name / address / dob from an emirates ID (think UAE / Dubai / Abu Dhabi), sample code as follows:

https://rapidapi.com/fvetroo5ri/api/verify-emirates-id
curl --request GET \

--url 'https://verify-emirates-id.p.rapidapi.com/default/EmiratesID?eid=784197600000000' \
--header 'X-RapidAPI-Host: verify-emirates-id.p.rapidapi.com' \
--header 'X-RapidAPI-Key: KEY GOES HERE'

and it returns data in the format;

{
"FirstName": "Mohammed",
"LastName": "Fatah",
"DateOfBirth": "1979-05-05",
"Emirate": "Dubai",
"Address": "Sheikh Mohammed Bin Rashed Boulevard Downtown Dubai, PO Box 123234 Dubai, UAE"
}

Very nice ... could be useful for KYC:
https://rapidapi.com/fvetroo5ri/api/verify-emirates-id
Categories: Uncategorized

License plate lookup #API now added support for #Tunisia

We are excited to announce that our License Plate Lookup API has now extended its services to include support for Tunisia. This latest update brings a valuable tool to the Tunisian market, enabling users to retrieve detailed vehicle information from a license plate number.

Technical Details of the Tunisia Support

Our API, accessible at the endpoint https://www.vehiculeapi.tn/api/reg.asmx?op=CheckTunisia, can now process car registration plates from Tunisia and return comprehensive vehicle details. This enhancement is tailored to meet the specific format of Tunisian license plates.

Understanding Tunisian Plates

Tunisian number plates are unique in their format, reading from right to left. For instance, the letters “TU” represent “تونس”, and “RS” stands for “ت ن”. A sample registration number like “818TU223” could also be interpreted as:

223تونس818

Data Returned by the API

Upon querying a Tunisian license plate, the API will return a wealth of information about the vehicle, including:

  • Make / Model: Identifies the brand and model of the car.
  • Year: The year of registration.
  • Fuel Type: Details the type of fuel the vehicle uses.
  • Variant: Specifies the variant of the model.
  • Engine Type: Provides information about the engine.
  • Representative Image: A URL to an image of the vehicle.

Sample JSON Response

For a better understanding, here’s a sample JSON response for the registration number “818TU223”:

{
  "Description": "Kia PICANTO",
  "RegistrationYear": "2017",
  "RegistrationDate": "01-01-2017",
  "CarMake": {
    "CurrentTextValue": "Kia"
  },
  "CarModel": {
    "CurrentTextValue": "PICANTO"
  },
  "MakeDescription": {
    "CurrentTextValue": "Kia"
  },
  "ModelDescription": {
    "CurrentTextValue": "PICANTO"
  },
  "FuelType": "Essence",
  "Variant": "III (JA) ( 03-2017 > )",
  "Engine": "1.0 67ch ( 03-2017 > ---- ) ",
  "Type": "VOITURE PARTICULIERE",
  "FiscalPower": "0",
  "ImageUrl": "http://www.vehiculeapi.tn/image.aspx/@S2lhIFBJQ0FOVE8="
}

This new feature is a significant step forward in our commitment to providing comprehensive and user-friendly vehicle information services worldwide. It opens up a new avenue for users in Tunisia to easily access detailed vehicle information with just a license plate number.

Stay tuned for more updates and enhancements to our License Plate Lookup API!

Categories: Uncategorized

Using the PayPal REST #API in C#

Some of this code requires custom-built libraries, so it’s not a great reference, but conceptually, you should be able to see how to use the PayPal REST API in C# using this technique

First, Authentication, you need to get a bearer token before you can all any interesting API endpoints;

        private static string Authenticate(Environment environment)
        {
            var credential = Sandbox;
            if (environment == Environment.LIVE) credential = Live;
            var auth = Convert.ToBase64String(Encoding.UTF8.GetBytes(
                credential.UserName + ":" + credential.Password));
            var http = new HTTPRequest 
            {
                HeaderHandler = h => new NameValueCollection
                {
                    { "Authorization", "Basic " + auth }
                }
            };
            var apiAuthEndpoint = "https://api-m.sandbox.paypal.com/v1/oauth2/token";
            if (environment == Environment.LIVE)
            {
                apiAuthEndpoint = "https://api-m.paypal.com/v1/oauth2/token";
            }
            const string strGrant = "grant_type=client_credentials";
            var authResponse = http.Request(apiAuthEndpoint, "POST", strGrant);
            var jAuthResponse = JObject.Parse(authResponse);
            var token = jAuthResponse["access_token"] + "";
            return token;
        }

Once you have a token, then you can create an order, which in effect gives you a URL to send the user to, and an ID that you should keep for future reference;

            var token = Authenticate(environment);
         
            var intPackageAmount = 100;
            var packageCurrency = "USD";

            var intent = new
            {
                intent = "CAPTURE",
                purchase_units = new[]
                {
                    new
                    {
                        amount = new
                        {
                            currency_code = packageCurrency,
                            value = intPackageAmount
                        }
                    }
                },
                payment_source = new
                {
                    paypal = new
                    {
                        experience_context = new
                        {
                            payment_method_preference = "UNRESTRICTED",
                            landing_page = "LOGIN",
                            user_action = "PAY_NOW",
                            return_url = domain + "/payments/paypalOrderComplete.aspx",
                            cancel_url = domain
                        }
                    }
                }
            };

            var json = JsonConvert.SerializeObject(intent, Formatting.Indented);
            var apiEndpoint = "https://api-m.sandbox.paypal.com/v2/checkout/orders";
            if (environment == Environment.LIVE)
            {
                apiEndpoint = "https://api-m.paypal.com/v2/checkout/orders";
            }
            var http = new HTTPRequest
            {
                HeaderHandler = h => new NameValueCollection
                {
                    { "Authorization", "Bearer " + token }
                },
                ContentType = "application/json"
            };
            var orderSetupJson = http.Request(apiEndpoint, "POST", json);
            var jOrderSetup = JObject.Parse(orderSetupJson);
            var paypalId = jOrderSetup["id"] + "";
            var linksArray = jOrderSetup["links"] as JArray;
            if (linksArray == null) throw new Exception("Paypal Order setup failed");
            var url = "";
            foreach (var link in linksArray)
            {
                if (link["rel"] + "" != "payer-action") continue;
                url = link["href"] + "";
                break;
            }

The Option that said “unrestricted”, helped later on with the capture part.

Once you’ve sent the user to the URL provided by paypal, and it’s returned to your return url, it should also provide you with a token in the Querystring, which matches the id of the order. – I’ve omitted the bit where this is held in a database while the user makes the payment.

Once it comes back, you need to capture the payment as follows;

   // Capture payment
   var apiCaptureEndpoint = "https://api-m.paypal.com/v2/checkout/orders/{0}/capture";
   if (environment == Environment.LIVE)
   {
       apiCaptureEndpoint = "https://api-m.paypal.com/v2/checkout/orders/{0}/capture";
   }
   apiCaptureEndpoint = string.Format(apiCaptureEndpoint, paypalOrderId);
   var captureResponse = http.Request(apiCaptureEndpoint, "POST", "");
   var jCaptureResponse = JObject.Parse(captureResponse);
   status = jCaptureResponse["status"] + "";

Status should be “COMPLETED” after this process is completed, and the money should be transferred.

Test first on sandbox before going live.

Categories: Uncategorized

Transfer #IIS bindings from one server to another using #Powershell

Ok, it’s a common task, you’re migrating from one server to another, but you have one website that responds to 100’s of bindings, and you have to move them. Of course you can copy and paste one by one, but here’s a script to do so. It also works with IDN domains.

First, on the source server, run this;

Import-Module WebAdministration

$siteName = "YOUR_SITE.COM"
$exportPath = "C:\TEMP\bindings.csv"

$bindings = Get-WebBinding -Name $siteName | 
            Where-Object { $_.protocol -eq 'http' } | 
            Select-Object protocol, bindingInformation

$bindings | Export-Csv -Path $exportPath -NoTypeInformation -Encoding UTF8

Then, copy the file bindings.csv to the new server, and import them using this

Import-Module WebAdministration

$siteName = "YOUR_SITE.com"
$importPath = "C:\temp\bindings.csv"

$bindings = Import-Csv -Path $importPath -Encoding UTF8

foreach ($binding in $bindings) {
    $protocol = $binding.protocol
    $bindingInformation = $binding.bindingInformation -split ':'
    $ipAddress = $bindingInformation[0]
    $port = $bindingInformation[1]
    $hostHeader = $bindingInformation[2]

    New-WebBinding -Name $siteName -Protocol $protocol -IPAddress $ipAddress -Port $port -HostHeader $hostHeader
}

This doesn’t work for HTTPS domains, since you need to copy the public/private keys as well, and it’s more complex.

Categories: Uncategorized