Trying to use the USPS Api for address validation in postman get an error - xmlhttprequest

I am using a post request in postman in order to validate the address against usps api:
<AddressValidateRequest USERID="123ITRS04217">
<Revision>1</Revision>
<Address ID="0">
<Address1>SUITE K</Address1>
<Address2>29851 Aventura</Address2>
<City/>
<State>CA</State>
<Zip5>92688</Zip5>
<Zip4/>
</Address>
</AddressValidateRequest>
but I get this error:
80040B19
XML Syntax Error: Please check the XML request to see if it can be parsed.
USPSCOM::DoAuth
The xml looks good to me, not sure what the issue here is

the following worked in Postman as a GET request:
https://secure.shippingapis.com/ShippingAPI.dll?API=Verify&XML=<AddressValidateRequest USERID="YOUR USERID HERE"><Revision>1</Revision><Address ID="0"><Address1/><Address2>STREET ADDRESS HERE</Address2><City/><State>2 LETTER STATE CODE</State><Zip5>FIVE DIGIT ZIP CODE</Zip5><Zip4/></Address></AddressValidateRequest>
Remember to substitute your values for:
YOUR USERID HERE
STREET ADDRESS HERE
2 LETTER STATE CODE
FIVE DIGIT ZIP CODE

Related

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.

RequestId and instanceId Bing Speech Recognition

I am trying to use the bing speech to text api and I have everything set up except for the requestid and instanceid. The api tells me WHAT they are but doesnt tell me HOW to get them can anyone help me out here? this is very frustrating and I cant figure out what to do
I also had an error:
WebException: The remote server returned an error: (400) Unable to get
requestid from the query string..
I did not understand where to get the requestid, so I took the one in the example and it works:
string url = "https://speech.platform.bing.com/speech/recognition/interactive/cognitiveservices/v1?language=en-US&requestid=39530efe-5677-416a-98b0-93e13ec93c2b";

Unable to test login using jmeter

I am newbie to jmeter. I am trying to test to login to my site say (example.com/session/new).
I have added the http cookie manager and 2 http request defaults.
In the first, am visiting example.com/session/new and extracting the authenticity token in the response data using regex meta content="(.+?)"name="csrf-token" . Now, in the second http request, I have a post request with the parameters as
name:utf value:(tickmark)
name :authenticity_token value: ${token}
name:email value:test#test.com
name:password value:test.
name:commit value:Sign In
And then am asserting for a text post login.
When I run the test, the assertion fails. as it results in 404.
In the request, I can see utf8=%E2%9C%93+&authenticity_token=%24%7Btoken%7D&email=test%40test.com&password=test&commit=Sign+In. Please help me fix this.
I know this is an old post, but I've been struggling with this exact same query, so I've decided to post my answer in case it helps anyone - it worked first time for me. So after requesting the login page for my site, the following csrf token is embedded in the html response;
<input type="hidden" name="csrfToken" value="fe5a48ebda7b98cbbf885b4a220ebe0c23b11125-1459096615520-1ac64aa945986cb1bd318d9c"/>
So when making the initial request for the login page, instead of using a Regular Expression Extractor, if the token is in the body of the HTML response, use an XPath Extractor instead.
If your response is not XML/XHTML compliant then tick the 'use tidy' checkbox.
For reference name add the reference you wish to refer to the token as e.g. token. When you add your parameters to the login request, you can then refer to your csrfToken as ${token}
Then for X-Path query use;
//input[#name="csrfToken"]/#value
The following tutorial shows you how to use a Regular Expression Extractor, but it should also help you to understand how to set up the query a bit more;
https://www.youtube.com/watch?v=SVxB3Tk4O4A&feature=iv&src_vid=hGkrSFKcj10&annotation_id=annotation_85358
Looks like you did every thing good , except correlation . After decoding your error url , I found that you correlation is not working . Below is the decoding URL "utf8=✓ &authenticity_token=${token}&email=test#test.com&password=test&commit=Sign In."
In your "Regular expression extractor" add below details
1. Reference Name:token
2. Regular Expression : name="csrfToken" value="(.+?)"
3. Template : $1$
4. Match No: 1
Note: Check the occurrences of "csrfToken", if you required first occurrence then enter 1 , if you required 2nd occurrence enter 2 ....etc.

eBay API addItem returns error - <Item.Country> is invalid or missing

I'm totally new to ebay api. I tried to use addItem api call, I stopped with this error.
`
eBay returned the following error(s):
37 : Input data is
invalid.Input data for tag <Item.Country> is invalid or
missing. Please check API documentation.
I've given all of their inputs and used their example (addItem code) only.
Site ID is 3 (UK) and currencyID="GBP"
See the link http://developer.ebay.com/devzone/xml/docs/reference/ebay/types/CountryCodeType.html.
Country Code for UK is GB.
So, your xml will be <Country>GB</Country>

Provisioning number using Twilio IncomingNumbers 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.