How can i get products list from external database

I would like to retreive product list from external database using IPoyntProductService.
Any idea how can i do that?

IPoyntProductService only works with products stored in Poynt cloud. You would need to write your service to work with an external database.

ok. So can i copy or import my products and categories to Poynt cloud programmatically using php for example ? cause i would like to use other Poynt services like payment and print receipt.

Yes,

We have a file upload option on poynt.net, but depending on the complexity of your catalog it may or may not work for you. You need to look at the upload template. Otherwise you can use our cloud APIs to create the catalog. Here’s an example how you can create a product:

		POST /businesses/{businessId}/products HTTP/1.1
		Host: services.poynt.net
		Content-Type: application/json
		Authorization: Bearer {access token}
		Poynt-Request-Id: {requestId}
		api-version: 1.2
		Cache-Control: no-cache
		
		{
		  "upc":"UPC-7b12fed6-25cf-1f0e-366b-ac858e1e745a",
		  "plu":"PLU-7b12fed6-25cf-1f0e-366b-ac858e1e745a",
		  "name":"Cheetos Crunch 757",
		  "description":"A flaming bag of Cheetos",
		  "specification":"Total Fat: 16%DV, Sodium:10%DV,, Carb: 4%DV",
		  "releaseDate":"2014-01-01T00:00:00Z",
		  "brand":"Cheetos",
		  "manufacturer":"FritoLay",
		  "publisher":"FritoLay",
		  "studio":"www.cheetos.com",
		  "msrp":{"amount":142, "currency":"USD"},
		  "tags":"junk food",
		  "sku":"SK-7b12fed6-25cf-1f0e-366b-ac858e1e745a",
		  "mpn":"FRTLY1",
		  "styleNumber":"Flaming",
		  "modelNumber":"BAG-O-CHIP",
		  "type":"SIMPLE",
		  "imageUrl":["http://www.butler.edu/admission/student-perspectives/blogs/bekah/files/2013/01/411ab_cheetossingle.jpg"],
		  "price":{"amount":142, "currency":"USD"},
		  "unitOfMeasure":"EACH",
		  "status":"ACTIVE",
		  "shortCode":"BOC"
		}

Please refer to our API reference to see which fields are required or optional.

OK. Should I create a cloud app?

Yes, create a cloud application in the Poynt HQ developer portal. Select both read and write permissions for the Products resource. You can also grant permissions to your app on behalf of any of your test merchants through the cloud-app management UI (so you can start making API calls against your test merchant app immediately, without having to go through the OAuth flow).

i created a cloud app now i’m reading the documentation

i use this php code below :

$url = "https://services.poynt.net/businesses/".$bus."/products";

$data = array('Content-type' => 'application/json', 'authorization' => $token, 

'poynt-request-id' => 'poyntRequstID',

' api-version' => '1.2');

$options = array(

    'http' => array(
   
    'header'  => "Content-type: application/x-www-form-urlencoded\r\n",
   
    'method'  => 'POST',
 
    'content' =>  http_build_query($data)
   
 )
  
 );

$context  = stream_context_create($options);


 $result = file_get_contents($url, false, $context);
  

 if ($result === FALSE) { /* Handle error */ }

var_dump($result);

but always i got 401 error.
And how can i get poyntRequstID?
Any idea or example?

Hi there,

From our API Reference:
POYNT-REQUEST-ID - a unique request id to enforce idempotency where ever appropriate (usually for POST requests)

2 possible reasons for status code 401:
401 - Unauthorized, due to invalid access token or authorization needed.

You have to make sure your test merchant has authorized the app id using step #8 on https://poynt.github.io/developer/tut/integrating-with-poynt-cloud-apis.html and you also need to make sure you are passing a valid access token in your request.