API - encoding sort URI with multiple sort fields / directions

I’m trying to build a sort URI with multiple sort fields and directions, but I don’t understand the syntax. Suppose I have this sort object with three fields/directions:

const sort = [
  { field: "title", direction: "asc" },
  { field: "value", direction: "desc" },
  { field: "category", direction: "asc" }

//I thought I could just daisy chain them like this, but it doesn't work.

let sortUri;

sort.forEach(sort => {
  console.log(sort.field, sort.direction);
  sortUri += `&sort%5B0%5D%5Bfield%5D=${encodeURIComponent(

const url = `&filterByFormula=AND(FIND(%221000%22%2C%20%7BLocation%7D)%20%3E%200%2CAND(%7BValue%7D%20%3C%2010000000))${sortUri}`;

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.