Error on Passing postdata on Ionic 5 to odoo

Hi there,

I am passing postdata to odoo api. When i tried with postman, it is ok and response is what i expected. but I tried to access via IONIC, always failed. the here is the response:

{“headers”:{“normalizedNames”:{},“lazyUpdate”:null,“headers”:{}},“status”:0,“statusText”:“Unknown Error”,“url”:“",“ok”:false,“name”:“HttpErrorResponse”,“message”:"Http failure response for 0 Unknown Error”,“error”:{“isTrusted”:true}}"

below is the code i tried.

var headers = new HttpHeaders({


  'Accept' : 'application/json'


let options = {

  headers: headers


let postData = {

        "jsonrpc": "2.0",

        "params": "{\"login\":\"\", \"pwd\":\"samplepwd\"}"

}"", postData, options)

  .subscribe(data => {

    console.log('NO ERROR' + JSON.stringify(data));

   }, error => {

    console.log('ERROR' + JSON.stringify(error));


when i tried with Nodejs , it is working too.below is the nodejs code.

var http = require('follow-redirects').http;
var fs = require('fs');

var options = {
  'method': 'POST',
  'hostname': 'localhost',
  'port': 8069,
  'path': '/supercon/authenpost',
  'headers': {
    'Content-Type': 'application/json'
  'maxRedirects': 20

var req = http.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {

  res.on("end", function (chunk) {
    var body = Buffer.concat(chunks);

  res.on("error", function (error) {

var postData = JSON.stringify({"jsonrpc":"2.0","params":{"login":"","pwd":"samplepwd"}});



below is another javascript that i tried, it is working too.

var data = JSON.stringify({"jsonrpc":"2.0","params":{"login":"","pwd":"samplepwd"}});

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function() {
  if(this.readyState === 4) {
});"POST", "http://localhost:8069/supercon/authenpost");
xhr.setRequestHeader("Content-Type", "application/json");


How can i use to connect using typescript on ionic 5?

Best Rgds,

I can be wrong but you don’t need extra quotes and escaping:

let postData = {
    jsonrpc: "2.0",
    params: {

Nor do you need manual JSON marshalling and unmarshalling or micromanaging headers to set Content-Type.

for odoo i use jsonrpc 2.0, the rest is normal.

take a screenshot of app request data in chrome devtool

i am using android emulator.

you can use chrome://inspect

hi ghostriderus,

I got the following two error:

the first one:

Failed to load resource: net::ERR_CONNECTION_REFUSED

second one:

{“headers”:{“normalizedNames”:{},“lazyUpdate”:null,“headers”:{}},“status”:0,“statusText”:“Unknown Error”,“url”:“",“ok”:false,“name”:“HttpErrorResponse”,“message”:"Http failure response for 0 Unknown Error”,“error”:{“isTrusted”:true}}"

try to replace to I have to replace with my computer ip. isn’t it?

Android emulator connect to localhost of host system by address

This is my git repo, I modified the angular7 odoo-jsonrpc module and using it.It requires native HTTP for perfect operation…
Download the source and place the folder starting with ‘manikandan’ and follow the instructions provided in…