Thanks Carmela, this is my post :
Hi Google APIs Team,
I have this error :
java.lang.*NoSuchMethodError*:
com.google.api.client.http.HttpRequest.setResponseReturnRawInputStream(Z)Lcom/google/api/client/http/HttpRequest;
For the line :
*ValueRange response = service.spreadsheets().values().get(spreadsheetId,
range).execute();*
My Code is :
*package technicalFunctionsclass ReadSpreadsheet { private static final
String CREDENTIALS_FILE_PATH =
"C:/Users/soukna/nefertiti_auto/client_secret.json"; private static
final String APPLICATION_NAME = "gcp-nerfertiti"; private static final
JsonFactory JSON_FACTORY = GsonFactory.getDefaultInstance(); private
static final String TOKENS_DIRECTORY_PATH = "tokens"; private static
final List<String> SCOPES =
Collections.singletonList(SheetsScopes.SPREADSHEETS_READONLY); //cette
méthode valide d'abord notre demande et crée une connexion entre la
bibliothèque d'API Google Sheets. private static Credential
getCredentials(final NetHttpTransport HTTP_TRANSPORT) throws IOException {
// Load client secrets. InputStream in1 = new
FileInputStream(CREDENTIALS_FILE_PATH); if (in1 == null) {
throw new FileNotFoundException("Resource not found: " +
CREDENTIALS_FILE_PATH); } GoogleClientSecrets clientSecrets =
GoogleClientSecrets.load(JSON_FACTORY, new InputStreamReader(in1));
// Build flow and trigger user authorization request.
GoogleAuthorizationCodeFlow flow = new
GoogleAuthorizationCodeFlow.Builder(HTTP_TRANSPORT,
JSON_FACTORY,clientSecrets, SCOPES).setDataStoreFactory(new
FileDataStoreFactory(new
java.io.File(TOKENS_DIRECTORY_PATH))).setAccessType("offline").build();
LocalServerReceiver receiver = new
LocalServerReceiver.Builder().setPort(8888).build(); return new
AuthorizationCodeInstalledApp(flow, receiver).authorize("user"); }
/** * Permet de lire La G-Sheet */ @Keyword public static
List<List<Object>> getSpreadSheetRecords(String range) throws IOException,
GeneralSecurityException { final NetHttpTransport HTTP_TRANSPORT =
new com.google.api.client.http.javanet.NetHttpTransport() final
String spreadsheetId = "1LXrgBIZx5K0XXWXBGaJGId1i3r8q_P6dGKhVacCVclo";
System.out.println("iCi"); Sheets service = new
Sheets.Builder(HTTP_TRANSPORT,
JSON_FACTORY,getCredentials(HTTP_TRANSPORT)).setApplicationName(APPLICATION_NAME).build();
ValueRange response =
service.spreadsheets().values().get(spreadsheetId, range).execute();
System.out.println("LA"+range+" "+spreadsheetId);
List<List<Object>> values = response.getValues(); if (values == null
|| values.isEmpty()) { System.out.println("No data found.");
return null; } else {
System.out.println("found"); return values; } }}*
*3 Weeks and no answer about this issue.*
*Please HELP ME !!!*
Le jeudi 5 janvier 2023 à 11:28:12 UTC+1, Google Ads API and AdWords API
Forum a écrit :
> Re-posting the last inquiry [
> https://groups.google.com/g/adwords-api/c/blDBedj6c4M] from the forum as
> it wasn't routed to our support queue.
>
> Regards,
> Carmela
> Google Ads API Team
> On Thursday, January 5, 2023 at 5:03:26 PM UTC+8
> [email protected] wrote:
>
>> Hi Google APIs Team,
>>
>> I have this error :
>>
>> java.lang.*NoSuchMethodError*:
>> com.google.api.client.http.HttpRequest.setResponseReturnRawInputStream(Z)Lcom/google/api/client/http/HttpRequest;
>>
>> For the line :
>> *ValueRange response = service.spreadsheets().values().get(spreadsheetId,
>> range).execute();*
>>
>>
>> My Code is :
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> *package technicalFunctionsclass ReadSpreadsheet { private static
>> final String CREDENTIALS_FILE_PATH =
>> "C:/Users/soukna/nefertiti_auto/client_secret.json"; private static
>> final String APPLICATION_NAME = "gcp-nerfertiti"; private static final
>> JsonFactory JSON_FACTORY = GsonFactory.getDefaultInstance(); private
>> static final String TOKENS_DIRECTORY_PATH = "tokens"; private static
>> final List<String> SCOPES =
>> Collections.singletonList(SheetsScopes.SPREADSHEETS_READONLY); //cette
>> méthode valide d'abord notre demande et crée une connexion entre la
>> bibliothèque d'API Google Sheets. private static Credential
>> getCredentials(final NetHttpTransport HTTP_TRANSPORT) throws IOException {
>> // Load client secrets. InputStream in1 = new
>> FileInputStream(CREDENTIALS_FILE_PATH); if (in1 == null) {
>> throw new FileNotFoundException("Resource not found: " +
>> CREDENTIALS_FILE_PATH); } GoogleClientSecrets clientSecrets =
>> GoogleClientSecrets.load(JSON_FACTORY, new InputStreamReader(in1));
>> // Build flow and trigger user authorization request.
>> GoogleAuthorizationCodeFlow flow = new
>> GoogleAuthorizationCodeFlow.Builder(HTTP_TRANSPORT,
>> JSON_FACTORY,clientSecrets, SCOPES).setDataStoreFactory(new
>> FileDataStoreFactory(new
>> java.io.File(TOKENS_DIRECTORY_PATH))).setAccessType("offline").build();
>> LocalServerReceiver receiver = new
>> LocalServerReceiver.Builder().setPort(8888).build(); return new
>> AuthorizationCodeInstalledApp(flow, receiver).authorize("user"); }
>> /** * Permet de lire La G-Sheet */ @Keyword public static
>> List<List<Object>> getSpreadSheetRecords(String range) throws IOException,
>> GeneralSecurityException { final NetHttpTransport HTTP_TRANSPORT =
>> new com.google.api.client.http.javanet.NetHttpTransport() final
>> String spreadsheetId = "1LXrgBIZx5K0XXWXBGaJGId1i3r8q_P6dGKhVacCVclo";
>> System.out.println("iCi"); Sheets service = new
>> Sheets.Builder(HTTP_TRANSPORT,
>> JSON_FACTORY,getCredentials(HTTP_TRANSPORT)).setApplicationName(APPLICATION_NAME).build();
>>
>> ValueRange response =
>> service.spreadsheets().values().get(spreadsheetId, range).execute();
>> System.out.println("LA"+range+" "+spreadsheetId);
>> List<List<Object>> values = response.getValues(); if (values == null
>> || values.isEmpty()) { System.out.println("No data found.");
>> return null; } else {
>> System.out.println("found"); return values; } }}*
>>
>> *3 Weeks and no answer about this issue.*
>>
>> *Please HELP ME !!!*
>>
>
--
--
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog:
https://googleadsdeveloper.blogspot.com/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
You received this message because you are subscribed to the Google
Groups "AdWords API and Google Ads API Forum" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en
---
You received this message because you are subscribed to the Google Groups
"Google Ads API and AdWords API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/adwords-api/1f1e0776-fa9c-4f11-bcb9-71f91e27833en%40googlegroups.com.