PGecom
  • 🚀Introduction
  • đŸŽ¯Guides
    • Getting authenticated
  • 📚Concepts
    • Sandbox Environment
  • 🧑‍đŸ’ģAPI Endpoint
    • Ecommerce
      • đŸ›ī¸Shop
        • GetShopById
        • CreateShop
      • 👔Product
        • ProductSchema
        • GetProductById
        • GetProductBySlug
        • CreateNewProduct
      • 🛒Checkout
        • CreateCheckoutSession
      • Form
        • GetFormById
      • Invoice
        • GetInvoiceById
    • Wordpress Plugin
    • Chrome Extension
    • GiftCards
      • â„šī¸Gift Card Schema
      • ✅List giftcards
      • â˜‘ī¸Order a gift card
      • â˜‘ī¸Get giftcard
      • â˜‘ī¸Rates
    • Send rewards
      • â„šī¸Rewards Schema
      • â˜‘ī¸Send rewards
    • Withdraw
      • â„šī¸Withdraw Schema
      • â˜‘ī¸Process Withdraw
      • â˜‘ī¸Rates
    • Radar
      • â„šī¸Radar Schema
      • â˜‘ī¸Check for Fraudster
    • Top Up
      • â„šī¸Topup Schema
      • â˜‘ī¸Estimate
      • â˜‘ī¸Send
    • Payment
      • Mon Cash
        • CreateMonCashPayment
        • VerifyMonCashPayment
        • WithdrawToMonCashEstimate
        • WithdrawFundsToMonCash
      • PG Pay
        • ConfigurePGPay
        • CreatePGPayPayment
        • VerifyPGPaymentWithToken
        • VerifyPGPaymentWithOrderId
    • Deprecated
      • Card Holder
        • â„šī¸Card Holder Schema
        • â˜‘ī¸Update
      • Card
        • â„šī¸Card Schema
        • ✅Retrieve a single card
        • ✅List cards
        • â˜‘ī¸Create a card
        • â˜‘ī¸Create Customer
  • 🎓Resources
    • Support
    • Production Access
Powered by GitBook
On this page

Was this helpful?

  1. API Endpoint
  2. Ecommerce
  3. Product

GetProductBySlug

This endpoint is there to get product by slug name

In the example below, slug is set for the name for the product slug

GET https://sandbox.pgecom.com/api/v1/product/slug/{{slug}}

Query Parameters

Name
Type
Description

shopId*

String

product shop id

[
    {
        "productType": "service",
        "published": false,
        "inventory": 20,
        "shopId": "9c4e8c79-b901-4b71-a305-0374664a0b65",
        "comparePrice": 0,
        "status": "active",
        "slug": "hair",
        "createdAt": "2023-11-04T02:04:51Z",
        "vendor": "pgecom",
        "name": "Hair",
        "isFeatured": false,
        "costPerItem": 0,
        "isContinueSellingOutStock": false,
        "userID": "5f56dfa3-a415-4818-8275-44fc63ece3fd",
        "updatedAt": "2023-11-04T02:04:51Z",
        "description": "Hair Product",
        "price": 50,
        "id": "b72b1e68-bb0d-48c2-ab85-ed0d24b7adfd",
        "mainImageUrl": "https://res.cloudinary.com/dnfoyqynm/image/upload/v1699063414/5f56dfa3-a415-4818-8275-44fc63ece3fd/pgecom/products/ebd7830c-f4aa-43fa-aeb4-ef2fedc4569e.jpg"
    }
]
{
    "message": "\"shopId\" is required",
    "status": 500
}
{
    "message": "Too many requests, please try again later.",
    "status": 429
}
{
    "message": "Products with slug id hai not found",
    "status": 404
}

const axios = require('axios');

let config = {
  method: 'get',
  url: 'https://sandbox.pgecom.com/api/v1/storefront/product/slug/hair?shopId=9c4e8c79-b901-4b71-a305-0374664a0b65',
  headers: { }
};

axios(config)
.then((response) => {
  console.log(JSON.stringify(response.data));
})
.catch((error) => {
  console.log(error);
});
import http.client

conn = http.client.HTTPSConnection("localhost", 3002)
payload = ''
headers = {}
conn.request("GET", "/api/v1/storefront/product/slug/hair?shopId=9c4e8c79-b901-4b71-a305-0374664a0b65", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
require "uri"
require "net/http"

url = URI("http://localhost:3002/api/v1/storefront/product/slug/hair?shopId=9c4e8c79-b901-4b71-a305-0374664a0b65")

http = Net::HTTP.new(url.host, url.port);
request = Net::HTTP::Get.new(url)

response = http.request(request)
puts response.read_body
<?php
require_once 'HTTP/Request2.php';
$request = new HTTP_Request2();
$request->setUrl('http://localhost:3002/api/v1/storefront/product/slug/hair?shopId=9c4e8c79-b901-4b71-a305-0374664a0b65');
$request->setMethod(HTTP_Request2::METHOD_GET);
$request->setConfig(array(
  'follow_redirects' => TRUE
));
try {
  $response = $request->send();
  if ($response->getStatus() == 200) {
    echo $response->getBody();
  }
  else {
    echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .
    $response->getReasonPhrase();
  }
}
catch(HTTP_Request2_Exception $e) {
  echo 'Error: ' . $e->getMessage();
}
curl --location 'http://localhost:3002/api/v1/storefront/product/b72b1e68-bb0d-48c2-ab85-ed0d24b7adfd'
PreviousGetProductByIdNextCreateNewProduct

Last updated 5 months ago

Was this helpful?

🧑‍đŸ’ģ
👔