Asterisk (*) not allowed in Status Update - api

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("[*]","*");

Related

postman giving 400 bad request when i use global varibales how to solve this

when i use normal json body postman gives me 201 created response but when i am using global variable postman giving me 400 bad request
Variables still need to be used in proper JSON format therefore you should be putting your strings in quotes:
{
"email": "{{email}}",
"password" : "{{password}}",
"confirmpassword" : "{{confirmpassword}}"
}
See https://learning.postman.com/docs/sending-requests/variables/
Side note: please provide actual "happy path" (when it worked) as well as your errors. Text instead of images is good too to help people try to reproduce your errors without a lot of typing

UPDATE and REVISE rest api is not working in vTiger CRM cloud service

So basically I need to use the update/revise Rest API to update the fields in the vTiger CRM.
But when I am using the rest API (link : https://help.vtiger.com/article/147111249-Rest-API-Manual) to update the fields, I am getting the error as "400 Unsupported operations: The request cannot be fulfilled due to bad syntax."
My api : endpoint/reviseelement=convert_into_json_string({id:5x369, potentialname:'demo2'})
Also apart from this, I had used the SQL query Rest API, to update the record in the modules, but it is also giving me the same error as: "400 Unsupported operations: The request cannot be fulfilled due to bad syntax."
My Api query : endpoint/query?query=UPDATE Potentials SET potentialname = 'demo2 where id = 5x369;
Also by using the webservice(https://community.vtiger.com/help/vtigercrm/developers/third-party-app-integration.html) rest api I am getting error like : "Permission to perform the operations is denied for id: ".
So how can I use the update api. Can anyone please help?
For web services API (https://community.vtiger.com/help/vtigercrm/developers/third-party-app-integration.html),
When you pass the payload data, make sure you're passing the x-www-form-urlencoded form of data.
Also, make sure you're passing 'element' argument with value like this:
{"id": "10x11471458", "leadsource": "Facebook"}.
if you're still facing this issue, you can share more details and I'll be happy to help you.
If you still need to do this the following should work.
Method: POST
End Point: /revise
Headers: "Authorization: Basic YOUR_TOKEN"
Body:
{
"element": {
"id":"5x369",
"potentialname": "demo2"
}
}
reference: https://www.vtiger.com/docs/rest-api-for-vtiger#/Revise

Getting illegal character when sending GET request in JMETER. Working fine in browser

Im getting illegal character in JMETER for GET request -
https://dev1/api/v1/query/job/?filter={%22job_manager_id%22:%22553f2350-12d3-4252-8fe0-39691019c495%22}
tried replacing %22 with "" but still getting illegal character.
Any solutions ?
I think problematic characters are { and }, they need to be percent-encoded
The options are in:
Tick "URL-encode" box next to the filter parameter in the HTTP Request sampler :
Use __urlencode() function in "Path" field like
see Apache JMeter Functions - An Introduction article to learn more about JMeter Functions concept
Or just hard-code the percent-encoded Path part like:
https://dev1/api/v1/query/job/?filter=%7B%22job_manager_id%22%3A%22553f2350-12d3-4252-8fe0-39691019c495%22%7D

Invalid request body error when sending json string as data to an external api using CL_HTTP_CLIENT

We are facing an issue while sending json data to an external api using CL_HTTP_CLIENT.
The JSON data is produced using '/ui2/cl_json=>serialize( data = ls_body compress = abap_true pretty_name = /ui2/cl_json=>pretty_mode-camel_case )' .
when sending this JSON as data the the external api returns status 400 with response as
{ "errorCode": "INVALID_REQUEST_BODY", "message": "The request body is missing or improperly formatted. Unexpected character encountered while parsing value: \u001f. Path '', line 0, position 0." } .
we also stringyfied this JSON Data in backend as it might be due to parsing error but it didnt work.
The same stringyfied data tried to send through browser console using ajax and it did worked without any issue.
could any any one tell us how to handle this json object and send this to external api using CL_HTTP_CLIENT.
Note : JSON STRING is deeply nested .
Thanks in advance..
You can use request catcher service for getting SAP output.
Then check your output has valid json.
Check external api with rest tool like postman or SoapUI. Every developer not track guidliness may be external api has limitations.
The issue was with the unicodes in the string.
these were not accepted by the external api so removed from the string and sent to api and it did worked.
Thanks for You suggestion.

SharePoint 2010 REST in iOS returns bad URL

I'm trying to query a Sharepoint List using REST. It works in IE and Chrome but in iOS after sending async request it jumps directly to didFailWithError returning:
Error Domain=NSURLErrorDomain Code=-1000 "bad URL" UserInfo=0xe95ba00 {NSUnderlyingError=0x8258680 "bad URL", NSLocalizedDescription=bad URL}
The REST code is:
#"http://mySP/site/siteColl/_vti_bin/ListData.svc/MyList?$filter=Infotyp eq 'NO'"
If I use:
#"http://mySP/site/siteColl/_vti_bin/ListData.svc/MyList"
instead, then everything is fine. Authorization is not an issue.
So why is the filter not working?
EDIT: Found out why. It's the spaces in the query. But how should I format them?
Got it. Used RESTQuery = [RESTQuery stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding] which returns a legal URL encoding