Add Purchase Vendor

Add Purchase Vendor

Purpose

To add new Vendor/location to your organization.

Request URL

https://live.membroz.com/api/vendors

Request Method

POST
Note
  • Send authkey in https header
  • You can add only one vendor per POST request.
  • You must use only Field API names in the input. You can obtain the field API names from Fields metadata API
  • Enterprise customer can replace domain name with their hosting Url. for example https://app.xyz.com/api/vendors
  • API will return inserted vendor data in JSON format or error message.

Request JSON

Attribute Data Type Mandatory Description
vendorname text yes vendor/location/company name
currency text
country text
timezone text
city text
companyphone text
contactperson text

Sample Request

curl --location --request PUT 'https://live.membroz.com/api/vendors'\
--header 'authkey: XXXXXXXXXX'\
--header 'Content-Type: application/json' \
--data-raw '
       {
       
        "status": "active",
        "vendorname": "Vendor 2",
        "branchid": "5eaeacdc09dc55fa5897bc61",
        "fullname":"vendor2",
        "property": {

            "address": null,
            "contact_number": null,
            "email": null,
            "vendorname": "Vendor 2"
        },
        "createdAt": "2020-08-25T09:56:59.008Z",
        "updatedAt": "2020-08-25T09:56:59.008Z",
        "updatedby": "5eaeacdc09dc55fa5897bc63",
        "addedby": "5eaeacdc09dc55fa5897bc63"
    }
   '
OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "\r\n       {\r\n       \r\n        \"status\": \"active\",\r\n        \"vendorname\": \"Vendor 2\",\r\n        \"branchid\": \"5eaeacdc09dc55fa5897bc61\",\r\n        \"fullname\":\"vendor2\",\r\n        \"property\": {\r\n\r\n            \"address\": null,\r\n            \"contact_number\": null,\r\n            \"email\": null,\r\n            \"vendorname\": \"Vendor 2\"\r\n        },\r\n        \"createdAt\": \"2020-08-25T09:56:59.008Z\",\r\n        \"updatedAt\": \"2020-08-25T09:56:59.008Z\",\r\n        \"updatedby\": \"5eaeacdc09dc55fa5897bc63\",\r\n        \"addedby\": \"5eaeacdc09dc55fa5897bc63\"\r\n    }\r\n   ");
Request request = new Request.Builder()
  .url("https://live.membroz.com/api/vendors")
  .method("PUT", body)
  .addHeader("authkey", "XXXXXXXXXX")
  .addHeader("Content-Type", "application/json")
  .build();
Response response = client.newCall(request).execute();
 "https://live.membroz.com/api/vendors",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "PUT",
  CURLOPT_POSTFIELDS =>"\r\n       {\r\n       \r\n        \"status\": \"active\",\r\n        \"vendorname\": \"Vendor 2\",\r\n        \"branchid\": \"5eaeacdc09dc55fa5897bc61\",\r\n        \"fullname\":\"vendor2\",\r\n        \"property\": {\r\n\r\n            \"address\": null,\r\n            \"contact_number\": null,\r\n            \"email\": null,\r\n            \"vendorname\": \"Vendor 2\"\r\n        },\r\n        \"createdAt\": \"2020-08-25T09:56:59.008Z\",\r\n        \"updatedAt\": \"2020-08-25T09:56:59.008Z\",\r\n        \"updatedby\": \"5eaeacdc09dc55fa5897bc63\",\r\n        \"addedby\": \"5eaeacdc09dc55fa5897bc63\"\r\n    }\r\n   ",
  CURLOPT_HTTPHEADER => array(
    "authkey: XXXXXXXXXX",
    "Content-Type: application/json"
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
import requests

url = "https://live.membroz.com/api/vendors"

payload = "\r\n       {\r\n       \r\n        \"status\": \"active\",\r\n        \"vendorname\": \"Vendor 2\",\r\n        \"branchid\": \"5eaeacdc09dc55fa5897bc61\",\r\n        \"fullname\":\"vendor2\",\r\n        \"property\": {\r\n\r\n            \"address\": null,\r\n            \"contact_number\": null,\r\n            \"email\": null,\r\n            \"vendorname\": \"Vendor 2\"\r\n        },\r\n        \"createdAt\": \"2020-08-25T09:56:59.008Z\",\r\n        \"updatedAt\": \"2020-08-25T09:56:59.008Z\",\r\n        \"updatedby\": \"5eaeacdc09dc55fa5897bc63\",\r\n        \"addedby\": \"5eaeacdc09dc55fa5897bc63\"\r\n    }\r\n   "
headers = {
  'authkey': 'XXXXXXXXXX',
  'Content-Type': 'application/json'
}

response = requests.request("PUT", url, headers=headers, data = payload)

print(response.text.encode('utf8'))
require "uri"
require "net/http"

url = URI("https://live.membroz.com/api/vendors")

https = Net::HTTP.new(url.host, url.port);
https.use_ssl = true

request = Net::HTTP::Put.new(url)
request["authkey"] = "XXXXXXXXXX"
request["Content-Type"] = "application/json"
request.body = "\r\n       {\r\n       \r\n        \"status\": \"active\",\r\n        \"vendorname\": \"Vendor 2\",\r\n        \"branchid\": \"5eaeacdc09dc55fa5897bc61\",\r\n        \"fullname\":\"vendor2\",\r\n        \"property\": {\r\n\r\n            \"address\": null,\r\n            \"contact_number\": null,\r\n            \"email\": null,\r\n            \"vendorname\": \"Vendor 2\"\r\n        },\r\n        \"createdAt\": \"2020-08-25T09:56:59.008Z\",\r\n        \"updatedAt\": \"2020-08-25T09:56:59.008Z\",\r\n        \"updatedby\": \"5eaeacdc09dc55fa5897bc63\",\r\n        \"addedby\": \"5eaeacdc09dc55fa5897bc63\"\r\n    }\r\n   "

response = https.request(request)
puts response.read_body
var client = new RestClient("https://live.membroz.com/api/vendors");
client.Timeout = -1;
var request = new RestRequest(Method.PUT);
request.AddHeader("authkey", "XXXXXXXXXX");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "\r\n       {\r\n       \r\n        \"status\": \"active\",\r\n        \"vendorname\": \"Vendor 2\",\r\n        \"branchid\": \"5eaeacdc09dc55fa5897bc61\",\r\n        \"fullname\":\"vendor2\",\r\n        \"property\": {\r\n\r\n            \"address\": null,\r\n            \"contact_number\": null,\r\n            \"email\": null,\r\n            \"vendorname\": \"Vendor 2\"\r\n        },\r\n        \"createdAt\": \"2020-08-25T09:56:59.008Z\",\r\n        \"updatedAt\": \"2020-08-25T09:56:59.008Z\",\r\n        \"updatedby\": \"5eaeacdc09dc55fa5897bc63\",\r\n        \"addedby\": \"5eaeacdc09dc55fa5897bc63\"\r\n    }\r\n   ",  ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);

Possible Errors

HTTP Status Error Code Message Reason
permission denied 403 You do not have permission

Sample Response

{
    "status": "active",
    "_id": "5f683ff2df68b7826d1e9cc3",
    "fullname": "vendor2",
    "branchid": "5eaeacdc09dc55fa5897bc61",
    "property": {
        "address": null,
        "contact_number": null,
        "email": null,
        "vendorname": "Vendor 2"
    },
    "createdAt": "2020-09-21T05:53:54.544Z",
    "updatedAt": "2020-09-25T11:18:46.752Z",
    "updatedby": "5eaeacdc09dc55fa5897bc63",
    "addedby": "5eaeacdc09dc55fa5897bc63"
}
Send Message
Hello!
How can we help!