Skip to main content
Solved

Make api call to remove.bg

  • December 20, 2021
  • 4 replies
  • 45 views

Forum|alt.badge.img+7

Has anyone been able to make an api call to remove.bg from scripting or a script within an automation?

Best answer by Justin_Barrett

Yeah remove.bg is relatively straight forward in the end

//get the url of the attachment field
  let angle1Url = angle1[0].url
    console.log(angle1Url)
    let response = await remoteFetchAsync('https://api.remove.bg/v1.0/removebg',
      {
        method: 'POST',
        body: JSON.stringify({
          "image_url": angle1Url,
          "size": "full",
          "scale":"90%",
          "bg_color" : "white",
          "type": "tiff",
          "output": "angle1.tiff"
        }),
        headers: {
          'Content-Type': 'application/json',
          'X-Api-Key': yourAPI_Key,
          'accept': 'application/json'
        },
      });
   
    let theData = await response.json()
   
    let base64String = theData.data.result_b64

I’m now struggling with cloud convert, well I have that working except I cant parse the webhook it sends with Airtables limited parsing, but I guess I’ll have to loop the api calls until it returns the processed result.


Here’s how I use it: call the main “jobs” endpoint to create the job with a list of tasks (import file, convert, export new file), call the “wait” endpoint which will return when the job is finished, then retrieve the file in a final call.

4 replies

Justin_Barrett
Forum|alt.badge.img+21
  • Inspiring
  • 4647 replies
  • December 26, 2021

I haven’t tried that API yet. Have you had more success since first submitting your question? If not, would you be willing to share sample code that you’ve tried?


Forum|alt.badge.img+7
  • Author
  • Inspiring
  • 9 replies
  • December 26, 2021

Yeah remove.bg is relatively straight forward in the end

//get the url of the attachment field
  let angle1Url = angle1[0].url
    console.log(angle1Url)
    let response = await remoteFetchAsync('https://api.remove.bg/v1.0/removebg',
      {
        method: 'POST',
        body: JSON.stringify({
          "image_url": angle1Url,
          "size": "full",
          "scale":"90%",
          "bg_color" : "white",
          "type": "tiff",
          "output": "angle1.tiff"
        }),
        headers: {
          'Content-Type': 'application/json',
          'X-Api-Key': yourAPI_Key,
          'accept': 'application/json'
        },
      });
   
    let theData = await response.json()
   
    let base64String = theData.data.result_b64

I’m now struggling with cloud convert, well I have that working except I cant parse the webhook it sends with Airtables limited parsing, but I guess I’ll have to loop the api calls until it returns the processed result.


Justin_Barrett
Forum|alt.badge.img+21
  • Inspiring
  • 4647 replies
  • Answer
  • December 27, 2021

Yeah remove.bg is relatively straight forward in the end

//get the url of the attachment field
  let angle1Url = angle1[0].url
    console.log(angle1Url)
    let response = await remoteFetchAsync('https://api.remove.bg/v1.0/removebg',
      {
        method: 'POST',
        body: JSON.stringify({
          "image_url": angle1Url,
          "size": "full",
          "scale":"90%",
          "bg_color" : "white",
          "type": "tiff",
          "output": "angle1.tiff"
        }),
        headers: {
          'Content-Type': 'application/json',
          'X-Api-Key': yourAPI_Key,
          'accept': 'application/json'
        },
      });
   
    let theData = await response.json()
   
    let base64String = theData.data.result_b64

I’m now struggling with cloud convert, well I have that working except I cant parse the webhook it sends with Airtables limited parsing, but I guess I’ll have to loop the api calls until it returns the processed result.


Here’s how I use it: call the main “jobs” endpoint to create the job with a list of tasks (import file, convert, export new file), call the “wait” endpoint which will return when the job is finished, then retrieve the file in a final call.


Forum|alt.badge.img+7
  • Author
  • Inspiring
  • 9 replies
  • December 28, 2021

Here’s how I use it: call the main “jobs” endpoint to create the job with a list of tasks (import file, convert, export new file), call the “wait” endpoint which will return when the job is finished, then retrieve the file in a final call.


Thank you Justin that was exactly the nudge I needed to get it working.