I have been trying to use third party service (Planyo) with Fetch api without success -> Parse Error: Invalid header value char

Hello every one !

I’m novice and been trying to use Planyo API “Is ressource available” here is the documentation : https://www.planyo . fr/api.php?topic=is_resource_available
I Give this api a date and a ressource ID and it should return a boolean true or false, for instance in my browser or with POSTMAN

https://www.planyo . com/rest/?resource_id=181059&start_time=1605139200&end_time=1605139200&quantity=1&assignment1=&api_key=5b3ad1aa306244c261e36e32eb27ef193fd65f03bb4958c01d299dfd524c6b&method=is_resource_available

Return this :

{
    "data": {
        "is_available": true,
        "problem_time": null,
        "quantity_available": "1"
    },
    "response_code": 0,
    "response_message": "Method is_resource_available executed successfully."
}

But When I try it on Wix with this code :

BACKEND-FILES :

import {fetch, getJSON} from 'wix-fetch';  

export function GetDispo () {
fetch("https://www.planyo . com/rest/?resource_id=181059&start_time=1605139200&end_time=1605139200&quantity=1&assignment1=&api_key=5b3ad1aa306244c261e36e32eb27ef193fd65f03bb4958c01d299dfd524c6b&method=is_resource_available", {"method": "get"})
  .then( (httpResponse) => {
 let url = httpResponse.url;
 let statusCode = httpResponse.status;
 let statusText = httpResponse.statusText;
 let headers = httpResponse.headers;
 let bodyUsed = httpResponse.bodyUsed;
 if (httpResponse.ok) {
 return httpResponse.json();
    }
 else {
 return Promise.reject("Fetch did not succeed");
    }
  } )
  .then( (json) => {
    console.log(json.someKey);
  } )
  .catch( (err) => {
    console.log(err);
  } );
}

MAIN PAGE CODE


import {GetDispo} from 'backend/Voirdispo';

$w.onReady(function () {
        GetDispo();
});

But I Always have this answer :

request to https://www.planyo . com/rest/?resource_id=181059&start_time=1605139200&end_time=1605139200&quantity=1&assignment1=&api_key=5b3ad1aa306244c261e36e32eb27ef193fd65f03bb4958c01d299dfd524c6b&method=is_resource_available failed, reason: Parse Error: Invalid header value char

If your’willing to test don’t mind using the apikey :wink:

1 Like

Same issue here

Same issue here, with 2checkout api

Has anyone found an answer to this issue? having the same issue with 2checkout.

I did directly reach out wix for that, it’s in process. But actually, even if it comes from servers, this error don’t come from providers, but from .Jsw files. If I have News, i’LM come back to you !