Getting error "GoogleJsonResponseException: API call to slides.presentations.batchUpdate failed with error: Invalid requests[3].updateShapeProperties: Invalid field: autofit_type"
but I think my code is right:
'updateShapeProperties': {
'objectId': pageElementId,
'fields': 'autofitType',
'shapeProperties': {
'autofit': {
'autofitType':'SHAPE_AUTOFIT'
}
}
}
Any help much appreciated
Cheers
Greg
I thought that the error message means that the value of fields is not correct. In your script, how about modifying as follows.
From:
'fields': 'autofitType',
To:
'fields': 'autofit.autofitType',
Note:
But, in the current stage, it seems that the value of autofitType can only use NONE. So, when SHAPE_AUTOFIT and TEXT_AUTOFIT is used for autofitType, an error of Autofit types other than NONE are not supported. occurs. Please be careful this.
About this, it seems that this is not reported as the future request in the issue tracker. So how about reporting it as the future request? Ref
When you test above modification, please modify 'autofitType':'SHAPE_AUTOFIT' to 'autofitType':'NONE'. By this, the request occurs no error.
Reference:
AutofitType
You're using an invalid field as what the error message says.
You can refer here for the available fields that can be used to replace your 'autofitType' field.
In response to Jason E. response, please see the documented Enum for AutofitType 1
Related
I am trying to Put and Delete data through Almofire Library but facing issue regarding parameters. Params are missing, following are the error:
Response JSON data = {
data = "<null>";
issuccess = 0;
msg = "{'car_id': [ErrorDetail(string='This field is required.', code='required')], 'car_brand_id': [ErrorDetail(string='This field is required.', code='required')], 'last_oil_change': [ErrorDetail(string='Date has wrong format. Use one of these formats instead: YYYY-MM-DD.', code='invalid')]} with error { Custom error message. }";
}
I am using the following code:
let params : [String : String] = ["brand_model_id": String(car_model_id), "oil_brand_id": String(oil_brand_id), "car_mileage": edCurrentMilage.text!, "car_modelyear": edVehicleModelYear.text!, "last_oil_change": edLastOilChange.text!]
Alamofire.request(Constants.APIURL + Constants.APIPOSTCARDATA ,method:.put, parameters: params, encoding: JSONEncoding.default, headers: header).responseJSON { [self] response in
guard response.result.isSuccess,
let value = response.result.value else {
print("Error while fetching tags: \(String(describing: response.result.error))")
self.hideIndicator()
// self.btn_submit_outlet.isEnabled = true
// completion(nil)
return
}
print(value)
let json = JSON.init(value as! NSDictionary)
print(json)
let code = json["issuccess"].boolValue
if(code)
{
self.hideIndicator()
Commons.showAlert(title: "Alert", error: "Data has been added.", VC: self)
}
else
{
self.hideIndicator()
Commons.showAlert(title: String.localizedStringWithFormat(NSLocalizedString("Alert", comment: "")), error: String.localizedStringWithFormat(NSLocalizedString("Something went wrong.", comment: "")), VC: self)
}
}
Above mention code is used for the PUT call Please help. Thanks in advance.
It's not against you particularly, BUT, it's something that is lacking a lot in this kind of questions.
Usually, by reading output error, in our case the server response we might, and I insist on "might", find the solution. But it's not always the case, sometimes error message is too generic, or pointing to the wrong direction. Here, error is saying about missing "car_id" param, but according to you it's not needed, so it's misleading (if we believe your saying).
Another usually good hint, is saying that "It's working on Android", "It's working in Postman", "It's working with a cURL command".
Usually, when this happen, I'm asking myself:
Why the author doesn't show the Postman, Android code, cURL command that would allow people knowing both tools/languages/platforms to spot a difference that could be the mistake.
Let's be honest, that would be easier, no? You might have quickly the right solution/fix, no? It's better than trying to guess battling agains the server response, no?
Now...
You are using Alamofire AND Postman. What if I told you that might be enough for you?
Quick trivia:
Did you know that Postman can generate code for the request?
It can even generate Swift Code for your request using URLSession? It's not "beautiful", "swifty" Swift code, but it's enough to spot difference and find why it's working on Postman and not in your code.
It can also generate cURL command? If you don't know about cURL a quick explanation would be "command line tool to make web request with params etc in Terminal.app/Bash/Shell, ie: it's basic and usually known by a lot of developers, so even if you only speak JavaScript, Java, etc, it's often like a "common language"
How? Even when I say that in comments, people don't even try to search for it... Let's find it with your favorite Search Engine, which should lead you to this tutorial/blog post. And tadaaa!
Did you know that AlamoFire can print request as cURL equivalent? It's stated here.
So in your case, what about asking Alamofire and Postman to generate cURL command and compare?
Then, you might want to change the parameters of the request, or even the parameters of the method request(_:method:parameters:encoding:headers:).
Why I am saying this?
Because if you don't give enough informations, there will be a delay between someone asking for more info/details in comment and yourself responding to them. Also, different commenters will ask for different questions, since debugging is a skill and causes might be multiples, we might ask different things, and only one will be relevant in the end to your issue, but we can't guess which one until then.
Because spotting difference is easier and might attract quicker response.
Now that you know about POSTMAN and Alamofire and cURL, you might even find yourself the solution. Even quicker than making a question on SO! Be your own hero!
In the end, only an "attractive" question will have good answers, so give as much info as possible, don't hold them (parameters sent, equivalent android code, screenshot at least of the Postman, but know that you know about the cURL generation code). Of course, keep your private token etc, obfuscate them a little, but still, you might have watch enough TV shows/movies where holding info is bad for the main characters, why repeating that mistake here?
As the error message says: Date has wrong format. Use one of these formats instead: YYYY-MM-DD.
Please check "last_oil_change" field. The value is from edLastOilChange.text. Does edLastOilChange.text meet the required format?
For reference, I read:
Can't get SingleValueExtendedProperties from Outlook contacts for certain data types with GRAPH
Yes, I see that this thread is pretty old, but I hope you will still assist. So I was trying to execute a similar query:
https://graph.microsoft.com/v1.0/me/mailfolders/sentitems/messages/AAAB[truncated]BAAA=?$expand=singleValueExtendedProperties($filter=id%20eq%20'String%200x5D01001E')
This is just POC at the moment as I was noticing the String Comments by Marc in the refered article. This particular property is
Tag: 0x5D01001E
Type: PT_STRING8
Property Name: PR_SENDER_SMTP_ADDRESS_A
Other Names: PR_SENDER_SMTP_ADDRESS, PidTagSenderSmtpAddress, PR_SENDER_SMTP_ADDRESS_W, ptagSenderSMTPAddress
DASL: http://schemas.microsoft.com/mapi/proptag/0x5D01001E
I really would like the Binary property:
Tag: 0x00360003
Type: PT_LONG Property
Name: PR_SENSITIVITY Other
Names: PidTagSensitivity,ptagSensitivity
DASL: http://schemas.microsoft.com/mapi/proptag/0x00360003
When trying either, the query runs without error, but I do not get the MAPI Property. I switched to the PTString8 property PR_SENDER_SMTP_ADDRESS to prove I can get a String, but Eric's post in the referred document seem to make me think he could get a Non String. Both queries run, but no MAPI Property.
Any help would be welcomed. Thanks!
I figured it out! (Also, note that my first example PR_SENDER_SMTP_ADDRESS 0x5D01, is undefined in Sentitems Folder).
*Please Note:
0x0036 = PR_SENSITIVITY
https://graph.microsoft.com/v1.0/me/messages/{MessageID}?$expand=singleValueExtendedProperties($filter=id eq 'Integer 0x0036')
*Substitute the {MessageID} to be the Message Id of the Mail Message in question.
I'm trying to send request using Postman to test Klarna payment, According to this API DOC, We use POST /checkout/v3/orders to send a request so that we can create order (For the testing environment they use https://api.playground.klarna.com/ + rest of url), But when i'm trying to send the given example in the above link(on the right side), It says that
{ "error_code" : "BAD_VALUE", "error_messages" : [ "Bad value: order_tax_amount" ], "correlation_id" : "12255531-ffcb-4a91-a375-04577fca78e5" }
When i read what does it require in the documentation, It says that the value should be formatted in some formula ±1 of total_amount - total_amount * 10000 / (10000 + tax_rate), When i calculate that the result 4545.4545 when i change the value in the request and try again, It gives the same error.
Can anybody help me with that?
Thanks
The docs you've linked say that order_tax_amount should be an integer of minor currency units, so it sounds like 4545.4545 isn't a valid value!
You should choose which direction you want to round in, then send an integer value instead.
I found the problem, I should change both total_tax_amount and order_tax_amount to be 4545, What a mistake, I think they should update this in their documentation so people be more familiar with it.
When testing the following URL string out in the Graph Explorer I get the expected return
me?fields=albums.limit(10){name,photos.limit(1){images}}
But when calling
FBRequestConnection.startWithGraphPath("me?fields=albums.limit(10){photos}",
parameters: nil,
HTTPMethod: "GET")
{ (connection: FBRequestConnection!,
result: AnyObject!,
error: NSError!) -> Void in
println(result)
}
It says that it's an unsupported URL. Do I need to access these properties via the 'parameters' option instead? I so, how do I go about that? I can't seem to get my head around it.
Any help is greatly appreciated
Chris
I had similar problem when I tried to get my feed and found no answers.
What I discovered is the URL format in Graph Explorer and iOS SDK is different.
iOS SDK don't like curly brackets, so your request for example should look like:
"me/albums?fields=photos"
In my case, that syntax works great. Unfortunately I have no idea how to specify the limit there.
//Edit:
To use modifiers like limit, you can do that this way:
"me/albums?fields=photos&limit=10"
Try referencing the albums fields like this:
"me?fields=albums.limit(10).fields(images)"
If I don't provide the value in the URL for Codeigniter, it'll display a PHP Error was encountered saying it's missing argument for a function call. I do NOT want it displayed at all. If there's no argument in the URL, it should just reroute to its index function. How do I prevent that from happening?
For example, www.example.com/profile/id/45
anyone would guess and enter like this "www.example.com/profile/id"
that would generate the error. How do I prevent that? I tried, "if (!isset($id))" but it generated error before it reached to that condition.
just learned that the solution is simple:
function id($id=NULL)
{
if ($id===NULL)
{
redirect....
}
}
you can also use:
$this->uri->segment(2); // gets 'id'
$this->uri->segment(3); // gets '45'
then do a redirect, check out:
http://codeigniter.com/user_guide/helpers/url_helper.html
use default values for your function
function id($id=0){
if(there any record with $id being provided){
//do something
}else{
//id not provided,set to default values 0 and then
show_404();
}
}
no way there could be id = 0 so its automatically showerror without redirect, if user enter the url www.example.com/profile/id ,