- പ്രസിദ്ധീകരിച്ചത്
Removebg API ഡോക്യുമെന്റേഷൻ

പ്രാരംഭം
curl --location 'https://removebg.one/api/v1/predict' \
--header 'Authorization: Bearer $API_KEY' \
--form 'file=@"test.png"'അഭ്യർത്ഥന ഡൊമെയ്ൻ
https://removebg.oneഅഭ്യർത്ഥന എണ്ട്പോയിന്റ്
/api/v1/predictAPI കീ സൃഷ്ടിക്കുക
API കീ പേജ് ല് നിങ്ങളുടെ API കീ സൃഷ്ടിക്കുക അല്ലെങ്കിൽ റീസെറ്റ് ചെയ്യുക.
അഭ്യർത്ഥന പാരാമീറ്ററുകൾ
-
നിലവിൽ, ഫയൽ ഓബ്ജക്റ്റുകൾ മാത്രം formData മുഖേന അയക്കാനാണ് സാധിക്കുക, അതിനാൽ Content-Type എല്ലായ്പ്പോഴും multipart/form-data ആകുന്നതെന്ന് ഉറപ്പാക്കുക.
-
API കീ പേജ് ല് API കീ സൃഷ്ടിച്ചതിനു ശേഷം, Authorization അഭ്യർത്ഥന ഹെഡറിൽ കീ മൂല്യം സെറ്റ് ചെയ്യുക.
Content-Type: multipart/form-data
Authorization: Bearer $API_KEY$API_KEY നിങ്ങളുടെ യഥാർത്ഥ API കീയുമായി മാറ്റുക എന്ന് ഓർക്കുക.
പ്രതികരണ പാരാമീറ്ററുകൾ
0 എന്ന തിരിച്ചറിവ് കോഡ് API കോൾ വിജയകരമായതായി സൂചിപ്പിക്കുന്നു. മറ്റേതെങ്കിലും കോഡ് പരാജയം പ്രതിനിധീകരിക്കുന്നു, പ്രത്യേകമായ പരാജയ കാരണം സന്ദേശം ഫീൽഡിൽ നൽകിയിരിക്കുന്നു.
- വിജയകരമായ പ്രതികരണം
{
"code": 0,
"data": {
"cutoutUrl": "https://r.removebg.one/static/8d062cc4-7d1d-4390-b958-a88e3a714e68.png?signature=...",
"maskUrl": "https://r.removebg.one/static/acd1904f-e7b6-4e20-92cc-29f19659caf8.png?signature=..."
}
}- പരാജയപ്പെട്ട പ്രതികരണം
{
"code": 400,
"message": "Invalid request parameters."
}ദയവായി ശ്രദ്ധിക്കുക: വിജയത്തോടെ തിരിച്ച് ലഭിക്കുന്ന ചിത്രത്തിന്റെ URL ഏകദേശം 1 മണിക്കൂർ മാത്രമേ പ്രായോഗികമായിരിക്കട്ടെ. നിങ്ങളുടെ ഉപയോഗം അനുസരിച്ച് അത് സംരക്ഷിക്കുക അല്ലെങ്കിൽ ഉപഭോക്താവിനെ സമയബന്ധിതമായി അറിയിക്കുക.
കോഡ് ഉദാഹരണങ്ങൾ
Fetch
const formData = new FormData()
formData.append('file', File)
fetch('https://removebg.one/api/v1/predict', {
method: 'POST',
body: formData,
headers: {
Authorization: 'Bearer $API_KEY',
},
})ജാവ
import org.apache.http.HttpEntity;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.entity.mime.MultipartEntityBuilder;
import org.apache.http.entity.mime.content.FileBody;
import org.apache.http.util.EntityUtils;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import java.io.File;
public class RemoveBgApiRequest {
public static void main(String[] args) throws Exception {
String apiKey = "YOUR_API_KEY"; // Replace with your API key
String filePath = "test.png"; // Replace with your file path
String url = "https://removebg.one/api/v1/predict";
File file = new File(filePath);
// Create HTTP client
try (CloseableHttpClient client = HttpClients.createDefault()) {
HttpPost post = new HttpPost(url);
post.setHeader("Authorization", "Bearer " + apiKey);
// Build multipart form data
FileBody fileBody = new FileBody(file);
HttpEntity entity = MultipartEntityBuilder.create()
.addPart("file", fileBody)
.build();
post.setEntity(entity);
// Execute request
String response = EntityUtils.toString(client.execute(post).getEntity());
// Parse the JSON response
JsonObject jsonResponse = JsonParser.parseString(response).getAsJsonObject();
int code = jsonResponse.get("code").getAsInt();
if (code == 0) {
// Success
System.out.println("Success: Response data = " + jsonResponse.getAsJsonObject("data"));
} else {
// Failure
String message = jsonResponse.has("message") ? jsonResponse.get("message").getAsString() : "Unknown error";
System.out.println("Failure: " + message);
}
}
}
}പൈത്തൺ
import requests
# Replace with your actual API key
api_key = 'your_api_key_here'
url = 'https://removebg.one/api/v1/predict'
# Path to the image file
file_path = 'test.png'
# Set up the headers with Authorization
headers = {
'Authorization': f'Bearer {api_key}'
}
# Open the image file in binary mode
with open(file_path, 'rb') as image_file:
# Send the POST request with the file
response = requests.post(url, headers=headers, files={'file': image_file})
# Check the response status
if response.code == 0:
print('Request successful')
# You can save or process the response content as needed
with open('output.png', 'wb') as output_file:
output_file.write(response.content)
else:
print(f'Error: {response.code}')
അവസാന കുറിപ്പുകൾ
ഏതെങ്കിലും ചോദ്യങ്ങൾ ഉണ്ടെങ്കിൽ, ദയവായി [email protected] എന്ന ഇമെയിലിലേക്ക് ഞങ്ങളെ ബന്ധപ്പെടുക.
- രചയിതാക്കൾ

- പേര്
- ഔദ്യോഗികം
- വെബ്സൈറ്റ്
- റിമൂവ്ബിജി