Forum Discussion
NeilSchneider
5 years agoQrew Cadet
Christopher,
Two problems - it's JSON.stringify (no caps)
Also you need to add a content-length header (value is the length of the stringified body)
Neil
------------------------------
Neil Schneider
------------------------------
Two problems - it's JSON.stringify (no caps)
Also you need to add a content-length header (value is the length of the stringified body)
Neil
------------------------------
Neil Schneider
------------------------------
- ChristopherWhe25 years agoQrew TraineeThanks, Neil! I've updated the code and now I'm getting a 400 error:
"https://api.quickbase.com/v1/records/query 400 (Bad Request)"
I've reached out to QuickBase support, hopefully they can help. The original code came from their API guide so they're now aware of the typo.
Best,
Chris
------------------------------
Christopher Wheatley
------------------------------- NeilSchneider5 years agoQrew CadetChris,
Did you add the Content-Length header? You'll get an error 400 if that header isn't present.
Also I'm assuming you are replacing the curly bracket enclosed items with the actual values, for example:
'QB-Realm-Hostname': yoursite.quickbase.com
'Authorization': 'QB-USER-TOKEN xxxxxx_xxxx_xxxxxxxxxxxxxxxxxxxxxxxxxx', -where xxx... is a token for your app
"from": "XXXXXXXXX", - where XXX... is the internal table name
Neil
Neil
------------------------------
Neil Schneider
------------------------------- ChristopherWhe25 years agoQrew TraineeNeil,
I did. The top section is now like below. Info in {XXXXXX} does contain the real values in the code page, I've obscured them here for security:
var body = {"from":"{XXXXXXXX}","select":[20,22,23,24,25,29,31,33],"where":"{'6'.Ex.'Yes'}AND{'20'.Ex.'New York'}"};
var headers = {
'QB-Realm-Hostname': '{XXXXXXXX}',
'Authorization': 'QB-USER-TOKEN {XXXXXXXX}',
'Content-Length': body.length,
'Content-Type': 'application/json'
}
------------------------------
Christopher Wheatley
------------------------------