HTTP Response Body Order

Hello there! Full disclosure, I’m pretty new to all of this, so thanks for putting up with me.
When I make an HTTP Get request, the order of the items in the response is not aligned with anything I’ve made so far. It’s giving me the columns out of order and with no reason that I can sort out. I should mention that it’s consistent in the order it gives me, just not matching anything I’m expecting.
Is there a way to specify that order? It would help my coding on the other end significantly.
Thank you!

Please post what code you already have for this so we know what you have done and where you are at etc.

In the meanwhile please check the Wix API for this and the Wix Support page for it as well.

Wix HTTP Function (Get HTTP):

Wix Fetch (GetJSON):

You can also see examples here which should give you a good idea as well.

Hi there,

Thanks for your response! I’ve been looking at those while I’ve built what I have so far (below), and overall it’s working. The thing I’d like to fix is the order in which the items are sent in the body of the HTTP message.

This is the URL I’m sending:

And the content I’m receiving is:
“items”: [{
“1R”: 100,
“project”: “1”,
“_id”: “15ec43b1-c1ee-4b42-beb1-6a6d8212e294”,
“_owner”: “eb74ca99-e6cf-44f7-8409-041c3ee278dd”,
“_createdDate”: “2020-04-06T03:56:47.318Z”,
“1I”: 0,
“_updatedDate”: “2020-04-13T03:38:00.589Z”,
“1T”: 1,
“receiverNumber”: “1”,
“1B”: 0,
“1G”: 0,
“title”: “P1-Location 1”

I’d like to put 1R, 1G, 1B, 1I, 1T at the beginning and receive the rest afterward.

Any thoughts would be great!


export function get_currentlightlevels(request) {
let options = {
“suppressAuth”: true ,
“suppressHooks”: true ,
“headers”: {
“Content-Type”: “application/json”
return wixData.query(“LightLevels”)
.eq(“project”, request.path[0])
.eq(“receiverNumber”, request.path[1])
.then( (results) => {
// matching items were found
if (results.items.length > 0) {
options.body = {
“items”: results.items
return ok(options);
// no matching items found
options.body = {
“error”: '${request.path[0]}' was not found
return notFound(options);
} )
// something went wrong
. catch ( (error) => {
options.body = {
“error”: error
return serverError(options);
} );