Edits history of script submission #22321 for ' List Objects (salesforce)'

  • bun
    One script reply has been approved by the moderators
    Ap­pro­ved
    //native
    
    /**
     * List Objects
     * List all objects available in the org (global describe), with their labels, API names, and capabilities (queryable, createable, custom).
     */
    export async function main(auth: RT.Salesforce) {
      const apiVersion = auth.api_version || "v60.0"
      const url = new URL(
        `${auth.instance_url}/services/data/${apiVersion}/sobjects/`
      )
    
      const response = await fetch(url, {
        method: "GET",
        headers: {
          Authorization: `Bearer ${auth.token}`,
          Accept: "application/json",
        },
      })
    
      if (!response.ok) {
        throw new Error(`${response.status} ${await response.text()}`)
      }
    
      return await response.json()
    }
    

    Submitted by hugo989 9 days ago