# \[Solved\] Help troubleshooting an API Post for URL shortening

**URL:** <https://community.thunkable.com/t/solved-help-troubleshooting-an-api-post-for-url-shortening/434438>\
**Category:** Questions about Thunkable X\
**Tags:** solved, webapi\
**Created:** [January 29, 2020, 8:11pm UTC](https://community.thunkable.com/t/solved-help-troubleshooting-an-api-post-for-url-shortening/434438 "2020-01-29T20:11:54Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jared](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/jared/32/138473_2.png) [@jared](https://community.thunkable.com/u/jared)\
**Post date:** [January 29, 2020, 8:11pm UTC](https://community.thunkable.com/t/solved-help-troubleshooting-an-api-post-for-url-shortening/434438/1 "2020-01-29T20:11:54Z")

</div>

Hello all. cany anyone help me figure out the API Post call?

Here is a share to the app i am working it in. [Thunkable](https://x.thunkable.com/copy/a5dda518c9629fd4a021b593188373a5)

I am trying to use the API Post blocks to send a complex url to [quickchart.io](http://quickchart.io) and in return to receive a shortened url.

I am having troubles understanding where to put the commands.

here is what i am into thus far.

the api code from the site (no api key needed)

 ![Screen Shot 2020-01-29 at 2.20.50 PM](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/3/d/3d6c758628e907d8b941fb66acc877f30f806562.png)

and what i have tried

 ![Screen Shot 2020-01-30 at 9.44.11 AM](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/5/a/5a4658894c6c46f2476e45e0d97a6df864bbbb9a.png)  
the api url is [https://quickchart.io/chart/create](https://quickchart.io/chart/create)

[update!] [quickchart.io](http://quickchart.io) is at least giving me a response now. however, it looks like this (i have emailed the owner of the website to see if there is anything that he can do for me on his end)

 ![Screen Shot 2020-01-30 at 9.52.22 AM](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/c/e/ce1fc6a74cd0fc8a2171b4f49f9716e84f19e279.png)

[UPDATE 2] - instead of using the CURL provided from the site. I converted the CURL into JSON per @jane’s suggestion. Then, I inject the JSON into the body of the POST.

Finally! I am now getting a shortened URL from the site. however, when i visit the shortened url, i am told that I am missing the ‘c’ or ‘chart’ variable.

 ![Screen Shot 2020-01-30 at 3.37.58 PM](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/b/d/bdd8bafd006516654952602748cbb11001cc5bba.png)  
{  
“url”: “[https://quickchart.io/chart/create](https://quickchart.io/chart/create)”,  
“raw\_url”: “[https://quickchart.io/chart/create](https://quickchart.io/chart/create)”,  
“method”: “post”,  
“headers”: {  
“Content-Type”: “application/json”  
},  
“data”: {  
“{"chart": {type:line,data:{labels:[January,February, March,April, May], datasets:[{label:Dogs, data: [50,60,70,180,190], fill:false,borderColor:blue},{label:Cats, data:[100,200,300,400,500], fill:false,borderColor:green}]}}}”: “”  
}  
}

---

<div class="post-metadata">

**Author:** ![jared](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/jared/32/138473_2.png) [@jared](https://community.thunkable.com/u/jared)\
**Post date:** [January 30, 2020, 9:23pm UTC](https://community.thunkable.com/t/solved-help-troubleshooting-an-api-post-for-url-shortening/434438/2 "2020-01-30T21:23:13Z")

</div>

close to Solved! (If anybody has an alternative way of creating graphs on an iPhone/iPad please let me know)

[https://x.thunkable.com/copy/4d6619712201d11e641ca5f0ca971c0b](https://x.thunkable.com/copy/4d6619712201d11e641ca5f0ca971c0b)

I will post the code later!  
[update] NOPE

this works. i got this code from an admin at quickchart  
{“chart”: {“type”: “bar”, “data”: {“labels”: [“Hello”, “World”], “datasets”: [{“label”: “Foo”, “data”: [1, 2]}]}}}

but for some reason this does not.  
{“chart”:{“type”: “line”, “data”: {“labels”: [“jan 1”,“jan 2”, “jan 3”], “datasets”: [{“label”: “cow”,“data”: [4,5,6], “fill”: “false”, “borderColor”:“red”}]},“options”: {“title”: {“display”: “true”, “text”: “Daily Behavioral Occurrence vs Non-Occurrence”}, “scales”: {“yAxes”: [{“scaleLabel”: {“display”: “true”, “labelString”:“Non-Occurrence / Occurrence”}, “ticks”:{“reverse”: “false”, “stepSize”:1}}]},},}}

the code from above does produce this in the live editor on the quickchart website but when i send the API POST demand i get the weird cloudfare message again.

![Screen Shot 2020-01-30 at 10.58.15 PM.png](https://mail.google.com/mail/u/0?ui=2&ik=cf4f405959&attid=0.5&permmsgid=msg-a:r-8839016641754479052&th=16ff9c11dd670c6d&view=fimg&sz=s0-l75-ft&attbid=ANGjdJ-RSqkS9g3MmQ7Aywi7gnKaCNRS276SADoSbSdTcrcrCBg7RO1hUmXDP5aNmPwKEF49eQEzI_h2Rw2TriJfnPjo7r3hwFZuSmWQQOTCoqKlI6xiL71S6DxYq_8&disp=emb&realattid=ii_k61n13z84)

this is from the [quickchart.io](http://quickchart.io) website  
(you’ll notice in the screenshot the lack of {“chart”:} as i use the website for live styling testing. however, i do include that in the API POST

---

<div class="post-metadata">

**Author:** ![jared](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/jared/32/138473_2.png) [@jared](https://community.thunkable.com/u/jared)\
**Post date:** [January 31, 2020, 11:09pm UTC](https://community.thunkable.com/t/solved-help-troubleshooting-an-api-post-for-url-shortening/434438/5 "2020-01-31T23:09:42Z")

</div>

It’s those dang fancy quotation marks that got me messed up. With the json requests, it will be vital to use the plain quotation marks. As such. I solved the issue using a JSON cleaner. [https://jsonformatter.curiousconcept.com/](https://jsonformatter.curiousconcept.com/)

{  
“chart”:{  
“type”:“line”,  
“data”:{  
“labels”:[  
“jan 1”,  
“jan 2”,  
“jan 3”  
],  
“datasets”:[  
{  
“label”:“cow”,  
“data”:[  
4,  
5,  
6  
],  
“fill”:“false”,  
“borderColor”:“red”  
}  
]  
},  
“options”:{  
“title”:{  
“display”:“true”,  
“text”:“Daily Behavioral Occurrence vs Non-Occurrence”  
},  
“scales”:{  
“yAxes”:[  
{  
“scaleLabel”:{  
“display”:“true”,  
“labelString”:“Non-Occurrence / Occurrence”  
},  
“ticks”:{  
“reverse”:“false”,  
“stepSize”:1  
}  
}  
]  
}  
}  
}  
}

---

<div class="post-metadata">

**Author:** ![ioannis](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/ioannis/32/146956_2.png) [@ioannis](https://community.thunkable.com/u/ioannis)\
**Post date:** [November 8, 2024, 11:41am UTC](https://community.thunkable.com/t/solved-help-troubleshooting-an-api-post-for-url-shortening/434438/6 "2024-11-08T11:41:19Z")

</div>


