To submit a description of warehouse products, you need to call our api. You will not get immediate feedback about the content. The list is submitted for processing, and further postbacks will identify any problems.
THIS PROCESS IS NOT CURRENTLY IMPLEMENTED
POST https://coberapi.com/api/1.0/products
Use the fields described in the Product List Properties.
We are using sampleproducts.json (TBD) to send a product list.
$order = file_get_contents("sampleorder.json");
$headers = array(
"Accept: application/json",
"Authorization: Bearer YOURTOKEN",
);
$ch = curl_init('https://coberapi.com/api/1.0/products');
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($order));
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$result = curl_exec($ch);
curl_close($ch);
const https = require('https');
const fs = require('fs');
const order = fs.readFileSync('sampleorder.json', 'utf8');
const headers = {
'Accept': 'application/json',
'Authorization': 'Bearer YOURTOKEN'
};
const options = {
hostname: 'coberapi.com',
path: '/api/1.0/products',
method: 'POST',
headers: headers
};
const req = https.request(options, (res) => {
let responseData = '';
res.on('data', (chunk) => {
responseData += chunk;
});
res.on('end', () => {
console.log(responseData);
});
});
using System;
using System.IO;
using System.Net;
using System.Text;
class Program
{
static void Main()
{
string url = "https://coberapi.com/api/1.0/products";
string token = "YOURTOKEN";
byte[] orderBytes = File.ReadAllBytes("sampleorder.json");
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
request.Method = "POST";
request.ContentType = "application/json";
request.Headers.Add("Authorization", "Bearer " + token);
using (Stream requestStream = request.GetRequestStream())
{
requestStream.Write(orderBytes, 0, orderBytes.Length);
}
using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
using (Stream responseStream = response.GetResponseStream())
using (StreamReader reader = new StreamReader(responseStream))
{
string responseData = reader.ReadToEnd();
Console.WriteLine(responseData);
}
}
}
import java.io.IOException;
import java.io.OutputStream;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.net.HttpURLConnection;
import java.net.URL;
import java.nio.charset.StandardCharsets;
public class Main {
public static void main(String[] args) throws IOException {
String url = "https://coberapi.com/api/1.0/products";
String token = "YOURTOKEN";
byte[] orderBytes = Files.readAllBytes(Paths.get("sampleorder.json"));
URL urlObject = new URL(url);
HttpURLConnection connection = (HttpURLConnection) urlObject.openConnection();
connection.setRequestMethod("POST");
connection.setDoOutput(true);
connection.setRequestProperty("Content-Type", "application/json");
connection.setRequestProperty("Authorization", "Bearer " + token);
try (OutputStream os = connection.getOutputStream()) {
os.write(orderBytes, 0, orderBytes.length);
}
int responseCode = connection.getResponseCode();
if (responseCode == HttpURLConnection.HTTP_OK) {
java.io.BufferedReader in = new java.io.BufferedReader(new java.io.InputStreamReader(connection.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
} else {
System.out.println("HTTP request failed with response code: " + responseCode);
}
}
}