Skip to content

Instantly share code, notes, and snippets.

@Arefu
Created March 31, 2025 07:31
Show Gist options
  • Save Arefu/b12d83a5dffb6573a1b1907044ad8de4 to your computer and use it in GitHub Desktop.
Save Arefu/b12d83a5dffb6573a1b1907044ad8de4 to your computer and use it in GitHub Desktop.
New World / Pak'nSave API Endpoints
GET
https://www.paknsave.co.nz/CommonApi/Cart/Index
GET
https://www.paknsave.co.nz/CommonApi/Delivery/GetStoreCollectionPoints?id=c0f80e87-16be-4488-9553-da437e8c6c2a
GET
https://www.paknsave.co.nz/CommonApi/Navigation/MegaMenu?v=&storeId=c0f80e87-16be-4488-9553-da437e8c6c2a
POST
https://www.paknsave.co.nz/CommonApi/Store/GetStoreList
GET
https://www.paknsave.co.nz/CommonApi/Checkout/GetAisleOfValueProducts
POST
https://www.paknsave.co.nz/CommonApi/Product/GetBannerAd
GET
https://www.paknsave.co.nz/CommonApi/Checkout/GetPreviousProductPurchases?number=20&isTrolley=false
GET
https://www.paknsave.co.nz/CommonApi/ShoppingLists/GetLists
https://api-prod.newworld.co.nz/v1/edge/search/paginated/products
@Arefu
Copy link
Author

Arefu commented Apr 4, 2025

class State {
    static [guid]$Store
    static [string]$Brand
}

function Get-StoresInformation {
    param(
        [Parameter(Mandatory = $true)]
        [ValidateSet("PakNSave", "NewWorld")]
        [string]$Brand
    )

    [State]::Brand = $Brand
    
    (Invoke-WebRequest -Uri "https://www.$Brand.co.nz/CommonApi/Store/GetStoreList" -Method Post `
        -UserAgent "(No_User_Agent)" `
        -Headers @{
        "Accept" = "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"
        "DNT"    = "1"
    }).Content
}

function Set-Store {
    param (
        [Parameter(Mandatory = $true)]
        [Guid]$Store,
        [Parameter(Mandatory = $true)]
        [ValidateSet("PakNSave", "NewWorld")]
        [string]$Brand
    )

    [State]::Store = $Store
    [State]::Brand = $Brand

    (Invoke-WebRequest -Uri "https://www.$Brand.co.nz/CommonApi/Store/ChangeStore?storeId=$Store&clickSource=list"`
     -UserAgent "(No_User_Agent)" `
    -Method Post `
        -Headers @{
        "Accept" = "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"
        "DNT"    = "1"
    }).Content
}

function Get-MegaMenuItems
{
    param (
        [Parameter(Mandatory = $true)]
        [Guid]$Store,
        [Parameter(Mandatory = $true)]
        [ValidateSet("PakNSave", "NewWorld")]
        [string]$Brand
    )

    [State]::Store = $Store
    [State]::Brand = $Brand
    (Invoke-WebRequest -Uri "https://www.$Brand.co.nz/CommonApi/Navigation/MegaMenu?v=&storeId=$Store"`
     -UserAgent "(No_User_Agent)" `
    -Method Get `
        -Headers @{
        "Accept" = "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"
        "DNT"    = "1"
    }).Content
}

function Export-StoreItems
{
    param (
        [Parameter(Mandatory = $true)]
        [Guid]$Store,
        [Parameter(Mandatory = $true)]
        [ValidateSet("PakNSave", "NewWorld")]
        [string]$Brand
    )
    Write-Warning "This *WILL* be slow."
   
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment