# Curl in FMP21 & square

**URL:** https://the.fmsoup.org/t/curl-in-fmp21-square/4594
**Category:** Questions
**Tags:** curl, insert-from-url
**Created:** [January 4, 2025, 4:35pm UTC](https://the.fmsoup.org/t/curl-in-fmp21-square/4594 "2025-01-04T16:35:12Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![vidkid98](https://yyz2.discourse-cdn.com/flex030/user_avatar/the.fmsoup.org/vidkid98/32/3179_2.png) [@vidkid98](https://the.fmsoup.org/u/vidkid98)
#### Post date: [January 4, 2025, 4:35pm UTC](https://the.fmsoup.org/t/curl-in-fmp21-square/4594/1 "2025-01-04T16:35:12Z")

</div>

Hello, new here. Hoping someone can help. I am attempting to use insert from URL script step to connect to Square's API. I've tested within the Square API Sandbox and the following seems to work okay, but when attempting to access from FMP 21, I get a "?\* Line, Column 1, Syntax error: value, object or array expected. Here's my config:

Environment: Mac OS, FMP 21,  
I put the following into the 'Specify Curl Options' in the Insert from URL options

" -X POST  
-H Square-Version: 2024-12-18  
-H Authorization: Bearer " & $accesskey & "  
-H Content-Type: application/json  
-d @$JSONData"

$JSONData is standard, I think:

{  
"company\_name" : "BigPlans",  
"email\_address" : "[helmut@schmidlap.com](mailto:helmut@schmidlap.com)",  
"family\_name" : "Helmut",  
"given\_name" : "Schmidlap",  
"idempotency\_key" : "012348768"  
}

I've set the url for the site (Square's sandbox to: "[https://connect.squareupsandbox.com/v2/payments](https://connect.squareupsandbox.com/v2/payments)" as a variable which VAR I put into the 'Specify URL' option dialog for the Insert from URL script Step.

But, I keep getting syntax error in line 1 column 1 when the script is executed.

---

<div class="post-metadata">

### Author: ![janhagemeister](https://avatars.discourse-cdn.com/v4/letter/j/6f9a4e/32.png) [@janhagemeister](https://the.fmsoup.org/u/janhagemeister)
#### Post date: [January 4, 2025, 8:14pm UTC](https://the.fmsoup.org/t/curl-in-fmp21-square/4594/2 "2025-01-04T20:14:28Z")

</div>

I think the options should be enclosed in quotation marks.

" -X POST -H "Square-Version: 2024-12-18" -H "Authorization: Bearer " & $accesskey & "" -H Content-Type: "application/json" -d "& Quote($JSONData)

(Please add the escape characters)

Jan

---

<div class="post-metadata">

### Author: ![vidkid98](https://yyz2.discourse-cdn.com/flex030/user_avatar/the.fmsoup.org/vidkid98/32/3179_2.png) [@vidkid98](https://the.fmsoup.org/u/vidkid98)
#### Post date: [January 4, 2025, 11:49pm UTC](https://the.fmsoup.org/t/curl-in-fmp21-square/4594/3 "2025-01-04T23:49:10Z")

</div>

I'm not sure I've it the way you suggested, here's what I put for the Curl option:

" -X POST -H "Square-Version: 2024-12-18" -H "Authorization: Bearer " & $accesskey & " -H Content-Type: "application/json" -d @$JSONData"

But, I get the same error.

---

<div class="post-metadata">

### Author: ![vidkid98](https://yyz2.discourse-cdn.com/flex030/user_avatar/the.fmsoup.org/vidkid98/32/3179_2.png) [@vidkid98](https://the.fmsoup.org/u/vidkid98)
#### Post date: [January 4, 2025, 11:52pm UTC](https://the.fmsoup.org/t/curl-in-fmp21-square/4594/4 "2025-01-04T23:52:20Z")

</div>

I tried this version as well:

" -X POST -H "Square-Version: 2024-12-18" -H "Authorization: Bearer " & $accesskey & "" -H Content-Type: "application/json" -d " & Quote($JSONData)

---

<div class="post-metadata">

### Author: ![janhagemeister](https://avatars.discourse-cdn.com/v4/letter/j/6f9a4e/32.png) [@janhagemeister](https://the.fmsoup.org/u/janhagemeister)
#### Post date: [January 5, 2025, 3:28am UTC](https://the.fmsoup.org/t/curl-in-fmp21-square/4594/5 "2025-01-05T03:28:02Z")

</div>

Please use the FileMaker JSON functions to generate the JSON to ensure that your JSON has the correct syntax.

Jan

---

<div class="post-metadata">

### Author: ![xochi](https://avatars.discourse-cdn.com/v4/letter/x/0ea827/32.png) [@xochi](https://the.fmsoup.org/u/xochi)
#### Post date: [January 5, 2025, 9:07pm UTC](https://the.fmsoup.org/t/curl-in-fmp21-square/4594/6 "2025-01-05T21:07:42Z")

</div>

Hi @vidkid98

Here's a simple test file. You'll notice a few differences from what you are doing:

1. using JSON functions to ensure we create proper JSON

 ![image](https://canada1.discourse-cdn.com/flex030/uploads/fmsoup/original/2X/d/d09aafc61ca66dcba5b2ab6324f3f3845ecb918f.png)

1. Headers are given using single-quoted values with `" \"` line continuation characters, like this:

 ![image](https://canada1.discourse-cdn.com/flex030/uploads/fmsoup/original/2X/2/291b32b390b2578d755aa053887d7fc172f08504.png)

When I run this test, I get a `1627 Authentication Failed error` which I think means the syntax is correct.

Here's the file:

[curltest2.fmp12.zip](https://the.fmsoup.org/uploads/short-url/mCggr7ss2JHV4X0vWomlj9NTnJG.zip) (147.2 KB)

(username: admin no password)

---

<div class="post-metadata">

### Author: ![rtrammel](https://avatars.discourse-cdn.com/v4/letter/r/96bed5/32.png) [@rtrammel](https://the.fmsoup.org/u/rtrammel)
#### Post date: [January 11, 2025, 1:37am UTC](https://the.fmsoup.org/t/curl-in-fmp21-square/4594/7 "2025-01-11T01:37:15Z")

</div>

Try wrapping each header line in escape quotes.

-H \”Authorization: Bearer “ & $token & “\”  
-H \”Content-Type: application/json\”  
etc

Sometimes I’ve had trouble with the shorthand for data. So instead of “-d” try “—data”  
Your “-X POST” line looks right

Sometimes the api needs the double quotes. I don’t know why, but I’ve seen this with a few others.
