Solved

pipefy api

  • 23 June 2022
  • 3 replies
  • 176 views

Userlevel 1
  • New Participant
  • 4 replies

Hi I'm trying to use the pipefy API and every time I send the request the response I get is 
        
       Access to XMLHttpRequest at 'https://api.pipefy.com/' from origin 'https://www.mywebsite.com' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

I would appreciate if you could take your time to help me 

thanks 

icon

Best answer by genietim 28 June 2022, 11:00

View original

3 replies

Userlevel 7
Badge +9

Hi @zevi, how are you?

Are you trying on https://app.pipefy.com/graphiql ? 

Could you share the query/mutation you are using, please?

Regards,

Userlevel 1

@lais-laudari thanks for your reply I copied down here the code I'm using 

 

 

var url = "https://app.pipefy.com/graphiql";

var xhr = new XMLHttpRequest();
xhr.open("POST", url);

xhr.setRequestHeader("Authorization", "here i put my auth token");
xhr.setRequestHeader("Content-Type", "application/json");

xhr.onreadystatechange = function () {
   if (xhr.readyState === 4) {
      console.log(xhr.status);
      console.log(xhr.responseText);
   }};

var data = `{
  cards(pipe_id:1234567) {
    edges {
      node {
        fields {
          name
          value
        } 
         
        
      }
    }
  }
}`;

xhr.send(data);

Userlevel 7
Badge +12

Hi @zevi 

 

The enpoint (URL) should be https://api.pipefy.com/graphql , so something along the lines of

 

var url = "https://api.pipefy.com/graphql";

var xhr = new XMLHttpRequest();
xhr.open("POST", url);

xhr.setRequestHeader("Authorization", "Bearer YourTokenHere");
xhr.setRequestHeader("Content-Type", "application/json");

xhr.onreadystatechange = function () {
if (xhr.readyState === 4) {
console.log(xhr.status);
console.log(xhr.responseText);
}};

var data = `query {
cards(pipe_id:1234567) {
edges {
node {
fields {
name
value
}
}
}
}
}`;

xhr.send(data);

 

should work.

The suggestion of Lais was for you to visit the suggested URL in the browser, as there, you can check whether the issue is the query (→ does not work there either) or the rest of your code (if the query works at https://app.pipefy.com/graphiql ).

Reply