Provisioning number using Twilio IncomingNumbers API - api

I'm POSTing the following url:
https://api.twilio.com/2010-04-01/Accounts/AC8a2..../IncomingPhoneNumbers?PhoneNumber=+13103417563
And getting the following error with no error number
400 is not a valid number
]]>
Anyone know why this is happening?

The plus in the phone number translates to a space, usually. You should try omitting it or then encode it.

Related

Unable to POST NZ employee openingBalances to Xero?

I am attempting to create a single opening balances record against an existing employee but keep getting a 400 Bad Request response with this detail...
At least one NZ opening balance item is required in the request
I am following the instructions as per this documentation...
https://developer.xero.com/documentation/api/payrollnz/employeeopeningbalances#post-opening-balances
URL : {DestinationID} is properly replaced with the employee GUIDhttps://api.xero.com/payroll.xro/2.0/employees/{DestinationID}/openingBalances
JSON Body[{"periodEndDate":"2011-01-30T00:00:00","daysPaid":5.00,"unpaidWeeks":0.00,"grossEarnings":1442.31}]
The Xero forums and support is pretty unreliable so I'm posting here in the hopes for a better response.
After some trial and error using the API Explorer that Xero provides I was able to get it working using their example....
I eventually learned that daysPaid and unpaidWeeks must both be integer whole numbers or else it fails.... The error message provided is misleading but this resolves the problem.

Youtube LiveChat API: messageTextInvalid

I'm using the Youtube livechat.insert API (https://developers.google.com/youtube/v3/live/docs/liveChatMessages/insert), and occasionally get back the messageTextInvalid error. However the error description page doesn't give much of a hint as to what's wrong here (https://developers.google.com/youtube/v3/live/docs/errors#liveChatMessages_youtube.liveChatMessages.insert). I've ensured the messages being sent are <= 200 characters long, and do not have newlines in them. However a message like '(Discord) person: COMMENT : Wonderful!' returns this error that the text is invalid. Is there some information that I can find about what text is valid in the message? I also didn't find much information on the livechat message resource page (https://developers.google.com/youtube/v3/live/docs/liveChatMessages#resource)

SQL LIKE '%...' in vba HTTP request

I am trying to run an SOQL query to the Salesforce REST API within a macro in Excel. I am using a LIKE statement to check if there are any email addresses with the same domain, which looks like this:
q=SELECT+email+FROM+Contact+WHERE+email+LIKE+'%#domain.com'
This is just the parameter given to the HTTP request, domain being a placeholder.
When I run the exact same request using Postman I get the correct response from the server, however in Excel I get Error 400 bad request.
When dropping the % it accepts the request, however then it obviously doesn't find any entries, as it is looking for the exact string "#domain.com".
Are there any known problems with the %-sign within vba? Or any other suggestions what could be the problem?
The problem is not with VBA, it is with your HTTP query. You need to escape the percent sign (%), which is a special characters. I guess Postman is doing this for you under the hood.
Hence, try :
q=SELECT+email+FROM+Contact+WHERE+email+LIKE+'%25#domain.com'
See : https://en.wikipedia.org/wiki/Percent-encoding#Percent-encoding_the_percent_character
If that's not enough for the query to succeed, you may as well escape the arobas sign (#):
q=SELECT+email+FROM+Contact+WHERE+email+LIKE+'%25%40domain.com'

How to properly encode special characters in a REST API url

EDIT: The NHTSA docs, as CBroe points out, say to replace an ampersand with an underscore. However, I'm also getting an error with forward slashes (albeit a different one, page not found, because it's decoding the slash), for example the make 'EXISS/SOONER':
http://www.nhtsa.gov/webapi/api/Recalls/vehicle/modelyear/1997/make/EXISS%2FSOONER?format=json
And replacing the ampersand with an underscore no longer results in an error message, but in zero results returned, which should not be the case.
ORIGINAL POST:
I'm trying to download the content from the following URL:
http://www.nhtsa.gov/webapi/api/Recalls/vehicle/modelyear/1997/make/s&s?format=json
And the site returns the following error message:
Server Error in '/' Application.
A potentially dangerous Request.Path value was detected from the client (&).
The problem is the ampersand; a similar request for a different car make works:
http://www.nhtsa.gov/webapi/api/Recalls/vehicle/modelyear/1997/make/toyota?format=json
I have verified from a different endpoint that S&S is a valid make for the API.
Based on stackoverflow answers, I've tried all the following without success:
http://www.nhtsa.gov/webapi/api/Recalls/vehicle/modelyear/1997/make/s%26s?format=json
http://www.nhtsa.gov/webapi/api/Recalls/vehicle/modelyear/1997/make/s%26amp;s?format=json
http://www.nhtsa.gov/webapi/api/Recalls/vehicle/modelyear/1997/make/s%26amp%3Bs?format=json

Realm didn't match redirect_uri/origin. Error code: 2

When I use the following URI for the Google OAuth request I get error below:
"Realm didn't match redirect_uri/origin. Error code: 2".
Can anyone tell me what I am doing wrong?
https://accounts.google.com/o/oauth2/auth?client_id=client_id_copied_from_the_developer_console&response_type=code&scope=openid%20email&redirect_uri=https://mysite.your-now.com/oauth2callback&state=security_token%3D138r5719ru3e1%26url%3Dhttps://mysite.your-now.com/navpage.do&login_hint=mycompany#gmail.com&openid.realm=your-now.com&hd=your-now.com
The realm value you are providing as openid.realm is malformed.
More specifically, the openid4java match method is failing with a MALFORMED_REALM result. Make sure you are providing a valid url as realm!
Hope that helps.