curl: (3) [globbing] nested brace in column 189 when sending PUT request to Google Sheets API curl: (3) [globbing] nested brace in column 189 when sending PUT request to Google Sheets API curl curl

curl: (3) [globbing] nested brace in column 189 when sending PUT request to Google Sheets API


I figured out, my use of API was incorrect. The right use of API is

curl -v \-H 'Authorization: Bearer ya29.GlxSB9-EiDh1Mn2EqhCslHvkaGyOX-P4_yDR4MXOt-WdHYQdFfwUJNMfljAFzZfS-YrrATUU2MAKj3R4BcMyOSw55KjJOC0EekE_qusj8GXIxFF3uaGZxGMdlB0IlQ' \-H 'Content-Type: application/json' \-X PUT \-d '{"range": "Sheet1!A1:D5","majorDimension": "ROWS","values": [["Item", "Cost", "Stocked", "Ship Date"], ["Wheel", "$20.50", "4", "3/1/2016"], ["Door", "$15", "2", "3/15/2016"], ["Engine", "$100", "1", "30/20/2016"], ["Totals", "=SUM(B2:B4)", "=SUM(C2:C4)", "=MAX(D2:D4)"]]}' \https://sheets.googleapis.com/v4/spreadsheets/1mHrPXQILuprO4NdqTgrVKlGazvvzgCFqIphGdsmptD8/values/Sheet1!A1:D5?valueInputOption=USER_ENTERED

The important points to note are
- valueInputOption=USER_ENTERED. I had to tell the API to parse the input so USER_ENTERED was a valid value as per the documentation
- The use of -H 'Content-Type: application/json' was needed since the payload was a valid json content.
- Sending the payload using -d option.

Once corrected, I was able to hit the API and get the response

*   Trying 2607:f8b0:400a:803::200a...* TCP_NODELAY set* Connected to sheets.googleapis.com (2607:f8b0:400a:803::200a) port 443 (#0)* ALPN, offering h2* ALPN, offering http/1.1* Cipher selection: ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:@STRENGTH* successfully set certificate verify locations:*   CAfile: /etc/ssl/cert.pem  CApath: none* TLSv1.2 (OUT), TLS handshake, Client hello (1):* TLSv1.2 (IN), TLS handshake, Server hello (2):* TLSv1.2 (IN), TLS handshake, Certificate (11):* TLSv1.2 (IN), TLS handshake, Server key exchange (12):* TLSv1.2 (IN), TLS handshake, Server finished (14):* TLSv1.2 (OUT), TLS handshake, Client key exchange (16):* TLSv1.2 (OUT), TLS change cipher, Client hello (1):* TLSv1.2 (OUT), TLS handshake, Finished (20):* TLSv1.2 (IN), TLS change cipher, Client hello (1):* TLSv1.2 (IN), TLS handshake, Finished (20):* SSL connection using TLSv1.2 / ECDHE-ECDSA-CHACHA20-POLY1305* ALPN, server accepted to use h2* Server certificate:*  subject: C=US; ST=California; L=Mountain View; O=Google LLC; CN=*.googleapis.com*  start date: Jul  2 19:21:00 2019 GMT*  expire date: Sep 24 18:57:00 2019 GMT*  subjectAltName: host "sheets.googleapis.com" matched cert's "*.googleapis.com"*  issuer: C=US; O=Google Trust Services; CN=Google Internet Authority G3*  SSL certificate verify ok.* Using HTTP2, server supports multi-use* Connection state changed (HTTP/2 confirmed)* Copying HTTP/2 data in stream buffer to connection buffer after upgrade: len=0* Using Stream ID: 1 (easy handle 0x7fc02e006600)> PUT /v4/spreadsheets/1mHrPXQILuprO4NdqTgrVKlGazvvzgCFqIphGdsmptD8/values/Sheet1!A1:D5?valueInputOption=USER_ENTERED HTTP/2> Host: sheets.googleapis.com> User-Agent: curl/7.54.0> Accept: */*> Authorization: Bearer ya29.GlxSB9-EiDh1Mn2EqhCslHvkaGyOX-P4_yDR4MXOt-WdHYQdFfwUJNMfljAFzZfS-YrrATUU2MAKj3R4BcMyOSw55KjJOC0EekE_qusj8GXIxFF3uaGZxGMdlB0IlQ> Content-Type: application/json> Content-Length: 272>* Connection state changed (MAX_CONCURRENT_STREAMS updated)!* We are completely uploaded and fine< HTTP/2 200< content-type: application/json; charset=UTF-8< vary: X-Origin< vary: Referer< vary: Origin,Accept-Encoding< date: Sat, 27 Jul 2019 19:23:15 GMT< server: ESF< cache-control: private< x-xss-protection: 0< x-frame-options: SAMEORIGIN< alt-svc: quic=":443"; ma=2592000; v="46,43,39"< accept-ranges: none<{  "spreadsheetId": "1mHrPXQILuprO4NdqTgrVKlGazvvzgCFqIphGdsmptD8",  "updatedRange": "Sheet1!A1:D5",  "updatedRows": 5,  "updatedColumns": 4,  "updatedCells": 20}* Connection #0 to host sheets.googleapis.com left intact