A1 notation V4. Can not access sheet with specified name - google-sheets-api

What is the right way to create range request for a sheet with name like '][_('
I get error:
curl 'https://sheets.googleapis.com/v4/spreadsheets/1fAdl80klrzQtPVu-ZJE4qcYhlPippj96xaQFpr3OE2k/values/"%5D%5B(_"!1:1?majorDimension=ROWS&valueRenderOption=UNFORMATTED_VALUE' -H 'Authorization: Bearer mytoken'
{
"error": {
"code": 400,
"message": "Unable to parse range: \"][(_\"!1:1",
"status": "INVALID_ARGUMENT"
}
}

GET https://sheets.googleapis.com/v4/spreadsheets/{spreadsheet_id}/values/'%5D%5B_('!1:1
or
GET https://sheets.googleapis.com/v4/spreadsheets/{spreadsheet_id}/values/%5D%5B_(!1:1
Basically what you had above, except using single quotes or no quotes. Double-quotes aren't a supported way to surround the sheet name.
You can find out for yourself in the future by using the API Explorer and plugging in the values you'd like -- it will spit out the proper URL-encoded GET request.

Related

Unable to create in google spreadsheets

I was trying google APIs to create a new sheet but I am unable to achieve the goal
the error I am getting is
Invalid spreadsheet. spreadsheet: This user did not create this id.
so I thought I am doing something wrong did some research I got this link (https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/create) and tried it here (Try it! button) it gives the same error
{
"error": {
"code": 400,
"message": "Invalid spreadsheet.spreadsheetId: This user did not create this id.",
"status": "INVALID_ARGUMENT"
}
}
What am I doing wrong?
Just performing the following request will create a spreadsheet:
POST https://sheets.googleapis.com/v4/spreadsheets
No need to pass something in the body. The documentation is a bit confusing on that point as it says you should send an instance of Spreadsheet in the request body. But you don't have to.

MPGS retrieve session unexpected parameters

I tried to follow the online guideline to do the hosted session integration.
When testing Retrieve session api using postman, the error occurred.
{
"error": {
"cause": "INVALID_REQUEST",
"explanation": "Unexpected parameter 'merchantId'"
},
"result": "ERROR"
}
I did settle the correct parameter, merchantId and sessionId.
https://ap-gateway.mastercard.com/api/documentation/apiDocumentation/rest-json/version/latest/operation/Session%3a%20Retrieve%20Session.html?locale=en_US
You don't actually include the text "merchantId". You have to provide a valid merchant ID. Click on the "URL Parameters" tab on the link you posted.
{merchantId} Alphanumeric + additional characters COMPULSORY
The unique identifier issued to you by your payment provider."
The same goes for "sessionId".

Question about testIamPermissions method in Billing API

I'm trying to use cloudbilling.billingAccounts.testIamPermissions in the APIs Explorer, but I get an error.
API URL
https://developers.google.com/apis-explorer/?hl=ko#p/cloudbilling/v1/cloudbilling.billingAccounts.testIamPermissions?resource=billingAccounts%252F01183E-6A3E97-BE2C7A&resource=%257B%250A%257D&_h=1&
Error Result
{
"error": {
"code": 400,
"message": "Request contains an invalid argument.",
"status": "INVALID_ARGUMENT"
}
}
The error message appears as 'Request contains an invalid argument', so the value entered in resource seems to be incorrect.
I entered billingAccounts / {billingAccountID} for resource, but I do not know why I get an error.
{billingAccountID} has entered the billing account ID you are using.
What value should be put in the resource?
You need to use your full ID "billingAccounts/012345-567890-ABCDEF`" as an string. Also avoid to share your private information for security reasons use examples instead.
Confirm that the other options of the API works for you.

How to Use getMaintenanceWindows method by using a SoftLayer REST API

please tell me how to get available maintenance windows by using a SoftLayer REST API.
I tried it in the following way, but it did not work.
curl -K support -d #Maintence.json -X POST https://api.softlayer.com/rest/v3/SoftLayer_Provisioning_Maintenance_Window/getMaintenceWindows
When executing the command, the following error message is displayed:
{"error":"End date must be a later date than begin
date.","code":"SoftLayer_Exception"}
The contents of the JSON file are described below:
{
"parameters":[
{
"beginDate": "2016-12-22T00:00",
"endDate": "2016-12-29T00:00",
"locationId": 138124,
"slotsNeeded" : 1
}]
}
The proper API to use here is SoftLayer_Provisioning_Maintenance_Window::getMaintenanceWindows() as opposed to the misspelled getMaintenceWindows
The API payload is still the same.
curl -K support -d #Maintence.json -X POST https://api.softlayer.com/rest/v3/SoftLayer_Provisioning_Maintenance_Window/getMaintenanceWindows
{
"parameters":[
"2016-12-22T00:00",
"2016-12-29T00:00",
138124,
1
]
}
When making API calls to the softlayer API, the parameters are not named, just listed in order that matches the documentation.
You just need to send the parameters (It's not necesary to define them in an object), so try with this json:
{
"parameters":[
"2016-12-22T00:00",
"2016-12-29T00:00",
138124,
1
]
}
References:
SoftLayer_Provisioning_Maintenance_Window::getMaintenceWindows

Asterisk (*) not allowed in Status Update

I'm trying to use the Twitter v1.1 API endpoint:
POST : https://api.twitter.com/1.1/statuses/update.json?status=%2A
-or-
POST : https://api.twitter.com/1.1/statuses/update.json?status=*
After seeing some suggestions about URL Encoding (percent encoding) I'm trying to encode the asterisk (*) character using %2A
Other character encoding works, as expected. But the asterisk character results in the following error:
{ "errors": [{ "code": 32, "message": "Could not authenticate you." }]}
You can reproduce the error using the API Console Tool:
https://dev.twitter.com/rest/tools/console2
For Authentication I chose the Oauth 1 option.
It is possible to send a single * as a status update via the API - see https://twitter.com/edent/status/664713007268823040
I suspect that the library you're using isn't properly calculating the OAuth signature. It would help if you showed us the code you use and which library you're relying on.
Just replace the asterisk * with the wide-asterisk *. It is perfectly working for me
String tweet_text="Tweet text with asterisk *";
tweet_text= tweet_text.replaceAll("[*]","*");