Search code examples
javaandroidwoocommercewoocommerce-rest-apimalformedurlexception

Malformed Url in case of woocommerce api through android


The "woocommerce api generate signature" url is

String getUrl = GET&http%3A%2F%2Fprojectrepo.net%2Fscoop%2Fwp-json%2Fwc%2Fv2%2Forders&oauth_consumer_key%3Dck_2f53925c....6407f09f67f5f118d01ed80e%26oauth_signature_method%3DHMAC-SHA1

When the url is passed through the below method,

URL url = new URL(getUrl);

"malformed url" error is shown.

And when the "GET&" is ommited from the url,this error is gone.But the "GET&" is needed for signature generation in woocommerce api.

What is the problem? If any doubt,please comment.

Thanks for your time.


Solution

  • Well the "GET&" characters before the url is mandatory for generating signature.When the actual posting of data is done the "GET&" characters should be ommited.

    Everyone thanks for your time.