Skip to content

How do I create a product? How do I search for a product? #77

Description

@Lollichkeit

My problem has been closed, but my problem is still there:

My problem:
My goal is:
Reading out whether the product is available and if not, then creating it, but I already have an error while creating it.

My code:

...
$product = new Product;
$title = new TranslatableText;
$title->text = 'Test';
$title->languageCode = 'de';

$product->title 		= $title;
$product->sku		= 'test';
$product->soldAmount	=  99.99;

print_r($product);

$test = $client->createProduct($product);
print_r($test);
...

My Error:
Fatal error:
Uncaught GuzzleHttp\Exception\ClientException:
Client error: POST https://app.billbee.io/api/v1/products resulted in a 400 Bad Request response: {"Message":"Die Anforderung ist ungültig.","ModelState":{"model.Title.text":["Cannot deserialize the current JSON objec (truncated...) in .../vendor/guzzlehttp/guzzle/src/Exception/RequestException.php:113 Stack trace: #0 .../vendor/guzzlehttp/guzzle/src/Middleware.php(65): GuzzleHttp\Exception\RequestException::create(Object(GuzzleHttp\Psr7\Request), Object(GuzzleHttp\Psr7\Response)) #1 .../vendor/guzzlehttp/promises/src/Promise.php(204): GuzzleHttp\Middleware::GuzzleHttp{closure}(Object(GuzzleHttp\Psr7\Response)) #2
.../vendor/guzzlehttp/promises/src/Promise.php(153):
GuzzleHttp\Promise\Promise::callHandler(1, Object(GuzzleHttp\Psr7\Response), NULL) #3
.../ap in .../vendor/guzzlehttp/guzzle/src/Exception/RequestException.php on line 113

My addendum:

Thanks again for your help. I am working on the problem again and I keep getting the error 500 Internal Server Error.
Can you help me please?

Uncaught GuzzleHttp\Exception\ServerException: Server error: 'POST https://app.billbee.io/api/v1/products' resulted in a '500 Internal Server Error' response:

#75

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions