Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8029959
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T00:36:27+00:00 2026-06-05T00:36:27+00:00

I am trying to get results from my custom search engine(cse) via api using

  • 0

I am trying to get results from my custom search engine(cse) via api using the Google Apps Script UrlFetchApp.fetch method. However, the url I am sending seems to be invalid. Will someone please tell me what I am doing wrong or if this is the wrong way to go about it?

function testGet(){  
  var q = "orell+auto"  
  var engID = "MY_ENGINE_ID"
  var cseAPIkey = "MY-KEY"  
  var response = UrlFetchApp.fetch("https://www.googleapis.com/customsearch/v1?&key="+ cseAPIkey + "&cx="+ engID +"q=" + q +"&fields=items(snippet%2Ctitle)%2Cspelling%2FcorrectedQuery");
  if (response.getResponseCode() == 200) {
    var text = response.getContentText();
    Logger.log(text);
  }
}

I don’t have a particular reason for using the UrlFetchApp.fetch method, I just wanted the simplest way to call my cse from google apps script and return the corrected query, title, and snippet from the results (the last bit of the url).

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T00:36:30+00:00Added an answer on June 5, 2026 at 12:36 am

    So i found that there were a couple of errors in the url – one from my own key input and one in the url as it is shown. Here is the fixed line of code:

    var response = UrlFetchApp.fetch("https://www.googleapis.com/customsearch/v1?&key="+ cseAPIkey + "&cx="+ engID +"&q=" + q +"&fields=items(snippet%2Ctitle)%2Cspelling%2FcorrectedQuery");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to get some custom routing going on in Magento using the following
Am using ui autocomplete from http://jqueryui.com/demos/autocomplete/#remote Using PHP in search.php to return results. Am
I'm currently trying to get a result from pyparsing as a pure list so
Im slightly going out of my mind trying to get 3 result sets from
I'm trying to SELECT, and get a unique result set, from a MySQL database,
I am trying to get my results to display inside of the loop but
I'm trying to query my database but for some reason I never get results
I've been trying to get my form to submit its results to a PHP
I'm trying to build up a string array in JavaScript and get the results
I am a bit puzzled with my Regex results (and still trying to get

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.