Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

  • Newbies

Hi,

 

I have scriptmaster running with Post Data to URL.

But there is problems with authentication.

 

My parameters is:

URL: https://api.operatorspage.com/2/sms/

VALUE: "batch_label": "Test", "message": "Hello world!"

KEY: Authorization Token zxczxczxczxc

 

How can I POST data to URL without get back this error?

java.io.IOExeption: Server returned HTTP response code: 401 for URL: https://api.operatorspage.com/2/sms/

 

My code:

 

// Construct data

String data = URLEncoder.encode(key, "UTF-8") + "=" + URLEncoder.encode(value, "UTF-8");

// use something like the following to send multiple key/value pairs

// data += "&" + URLEncoder.encode(key2, "UTF-8") + "=" + URLEncoder.encode(value2, "UTF-8");

 

// Send data

URL url = new URL(url);

URLConnection conn = url.openConnection();

conn.setDoOutput(true);

OutputStreamWriter wr = new OutputStreamWriter(conn.getOutputStream());

wr.write(data);

wr.flush();

 

// Get the response

String response = conn.getInputStream().getText("utf-8");

wr.close();

return response;

 

Thanks!

/Stefan

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.