Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Search for products (etc) don't return data. #22

Closed
TiBianMod opened this issue Nov 3, 2019 · 3 comments
Labels

Comments

@TiBianMod
Copy link

@TiBianMod TiBianMod commented Nov 3, 2019

I'm trying to use the search endpoint "/api/v1/search".

The response from the server has "status Code: 200", but i don't see anywhere related data with the search.

use BillbeeDe\BillbeeAPI\Client;

$user = Config::get('BILLBEE_USER');
$apiPassword = Config::get('BILLBEE_API_PASSWORD');
$apiKey = Config::get('BILLBEE_API_KEY');

$client = new Client($user, $apiPassword, $apiKey);

$response = $client->post('search', [
    'form_params' => [
        'Type' => 'product',
        'Term' => 'title:"samsung"',
    ]
]);

Here is the response from the server.

Response {#5671 ▼
  -reasonPhrase: "OK"
  -statusCode: 200
  -headers: array:11 [▶]
  -headerNames: array:11 [▶]
  -protocol: "1.1"
  -stream: Stream {#5691 ▶}
}
@devtronic

This comment has been minimized.

Copy link
Member

@devtronic devtronic commented Nov 4, 2019

This endpoint is not implemented at the moment. Check out my comment here: #21 (comment)

Additional Code:

class SearchResult
{
    /** @\MintWare\DMM\DataField() */
    public $Customers = [];
    /** @\MintWare\DMM\DataField() */
    public $Orders = [];
    /** @\MintWare\DMM\DataField() */
    public $Products = [];
}

class MyClient extends Client
{
    public function search($searchTerm, $type = [0, 1, 2, 3])
    {
        return $this->requestPOST(
            'search', // Search endpoint
            [
                'Type' => $type,
                'Term' => $searchTerm,
            ],
            SearchResult::class // response class
        );
    }
}


$myClient = new MyClient($user, $apiPassword, $apiKey);
var_dump($myClient->search('400232'));
@devtronic

This comment has been minimized.

Copy link
Member

@devtronic devtronic commented Nov 15, 2019

The search call will be available with the next release of the sdk

@devtronic devtronic closed this Nov 15, 2019
@TiBianMod

This comment has been minimized.

Copy link
Author

@TiBianMod TiBianMod commented Nov 15, 2019

Very Nice, Thanks :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.