How to create and upload a shipment-model json file to GCS | Google Maps Route Optimization for PHP #7708
Rudi-Mediawave
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi, thanks for advice and help.
Currently I am using a library from Google: "google/maps-routeoptimization" specifically for PHP to create a shipment-model.json file and will upload it to GCS.
The code I have created so far is as follows:
So far, the code runs without any errors and successfully creates a json file like this:
The question is:
I usually use the cli command below to upload shipping models to GCS.
Send shipment-model command:
curl -X POST -H "Content-Type: application/json" -H "Authorization: Bearer $(gcloud auth print-access-token)" -H "x-goog-user-project: [PROJECT_ID]" -d @shipment-model.json https://cloudoptimization.googleapis.com/v1/projects/[PROJECT_ID]:batchOptimizeTours
and check status command:
curl -X GET -H "Authorization: Bearer $(gcloud auth print-access-token)" -H "x-goog-user-project: [PROJECT_ID]" "https://cloudoptimization.googleapis.com/v1/projects/[PROJECT_ID]/operations/{RESULT-FROM-FIRST_COMMAND}"
I have tried looking for documents on this but have been unable to find any.
Does anyone care to provide guidance? thanks and sorry for my bad english.
Beta Was this translation helpful? Give feedback.
All reactions