Closed matres85 closed 1 year ago
Ok, I had solved it by changing the double quotes in the JSON payload to single quotes, and wrapping the data in double quotes.
"{ 'gcs_source': { 'uris': 'gs://vertex_vision_ai_first/products.jsonl' }, 'format': 'FORMAT_JSONL' }"
Hi Team,
I'm trying to import products to my catalog with curl command (based on this tutorial https://cloud.google.com/vision-ai/docs/product-recognizer#importproduct)
curl.exe -sS -X POST -H "Authorization: Bearer $(gcloud auth print-access-token)" -H "Content-Type: application/json" https://visionai.googleapis.com/v1alpha1/projects/my_project_id/locations/us-central1/retailCatalogs/VertexVisionAI_First:importRetailProducts -d '{ "gcs_source": { "uris": "gs://vertex_vision_ai_first/products.jsonl" }, "format": "FORMAT_JSONL" }'
File products.jsonl
{"retailProduct":{"name":"cukier_waniliowy","gtins":["5900437012278"]},"retailProductImages":[{"name":"waniliowy","gcsUri":"gs://vertex_vision_ai_first/product_images/waniliowy.jpg"}]} {"retailProduct":{"name":"budyn_bananowy","gtins":["5900437021294"]},"retailProductImages":[{"name":"bananowy","gcsUri":"gs://vertex_vision_ai_first/product_images/bananowy.jpg"}]} {"retailProduct":{"name":"budyn_toffi","gtins":["5900437020310"]},"retailProductImages":[{"name":"toffi","gcsUri":"gs://vertex_vision_ai_first/product_images/toffi.jpg"}]} {"retailProduct":{"name":"budyn_smietankowy","gtins":["5900437020112"]},"retailProductImages":[{"name":"smietankowy","gcsUri":"gs://vertex_vision_ai_first/product_images/smietankowy.jpg"}]}
but I'm getting error
{ "error": { "code": 400, "message": "Invalid JSON payload received. Unexpected token.\ngcs_source: { uris: gs://vertex_vision_a\n ^", "status": "INVALID_ARGUMENT" } }
What I'm doing wrong?