Issues an API request to create a new account sell.
485407
public function createSell(Sell $sell, array $params = [])
    {
        $this->getClient()->createAccountSell($this, $sell, $params);
    }
623412
function create(callback, payee, name) {
  if(!util.isFunction(callback)) {
    throw new Error('callback must be a function');
  }

  var resource = this.coinjar.personal.api_endpoint + '/v1/contacts.json',
    query = {
      contact : {}
    };

  if(payee) { query.contact.payee = payee; }
  if(name) { query.contact.name = name; }

  request.post(resource)
    .auth(this.coinjar.personal.auth_token)
    .send(query)
    .end(function (response) {
      if(isResponseError(response, callback)) { return; }
      return callback(null, response.body.contact);
    });
}
1160893
function oneBroker(api_key) {
  var self = this;
  var config = {
    url: 'https://www.1broker.com/api',
    version: 'v1',
    api_key: api_key,
    timeoutMS: 10000
  };
  /**
  * Private methods supported
  * For information on the parameters, check 1broker website https://1broker.com/?c=api_documentation
  */

  /* Account */
  function accountInfo(callback) {
    var path  = '/' + config.version + '/account/info.php';
    var params = {};
    return apiMethod(path, params, callback);
  }
  function accountAddress(callback) {
    var path  = '/' + config.version + '/account/bitcoindepositaddress.php';
    var params = {};
    return apiMethod(path, params, callback);
  }
  /* Orders */

  // Coming soon //

  /* Position */
  function positionList(callback) {
    var path  = '/' + config.version + '/position/list_open.php';
    var params = {};
    return apiMethod(path, params, callback);
  }
  function positionEdit(position_id, callback) {
    var path  = '/' + config.version + '/position/list_open.php';
    var params = {};
    return apiMethod(path, params, callback);
  }
  /* Market Data */
  function marketList(callback) {
    var path  = '/' + config.version + '/market/list.php';
    var params = {};
    return apiMethod(path, params, callback);
  }
  function marketDetail(symbol, callback) {
    var path  = '/' + config.version + '/market/detail.php';
    var params = "symbol="+symbol;
    return apiMethod(path, params, callback);
  }
  function marketQuotes(symbols, callback) {
    var path  = '/' + config.version + '/market/quotes.php';
    var params = "symbols="+symbols;
    return apiMethod(path, params, callback);
  }
  /**
   * This method makes a private API request.
   * @param  {String}   path   The path to the API method
   * @param  {Object}   params   String of arguments to pass to the api call
   * @param  {Function} callback A callback function to be executed when the request is complete
   * @return {Object}            The request object
   */
  function apiMethod(path, params, callback) {
    var url    = config.url + path + '?token=' + config.api_key;
    if(params) url = url+= '&'+params;
    return apiRequest(url, callback);
  }
  /**
   * This method sends the actual HTTP request
   * @param  {String}   url      The URL to make the request
   * @param  {String}   requestType   POST or GET
   * @param  {Object}   params   POST or GET body
   * @param  {Function} callback A callback function to call when the request is complete
   * @return {Object}            The request object
   */
  function apiRequest(url, callback) {
    var options = {
      url: url,
      method: 'GET',
			timeout: config.timeoutMS,
      maxAttempts: 3,
      retryDelay: 2000,  // (default) wait for 2s before trying again
      retryStrategy: request.RetryStrategies.HTTPOrNetworkError // (default) retry on 5xx or network errors
    };

    var req = request(options, function(error, response, body) {
      if(typeof callback === 'function') {
        var data;
        if(error) {
          callback.call(self, new Error('Error in server response: ' + JSON.stringify(error)), null);
          return;
        }
        try {
          data = JSON.parse(body);
          if(data.error != false){
            callback.call(self, new Error('API error.'), null);
          } else {
            // All good.
            callback.call(self,null,data.response);
          }
        }
        catch(e) {
          callback.call(self, new Error('Could unknown server response occured.'), null);
          return;
        }
      }
    });

    return req;
  }

  self.accountInfo = accountInfo;
  self.accountAddress = accountAddress;
  self.positionList = positionList;
  self.positionEdit = positionEdit;
  self.marketList = marketList;
  self.marketDetail = marketDetail;
  self.marketQuotes = marketQuotes;
}
1050727
async def put(self, public_key):
		
		if settings.SIGNATURE_VERIFICATION:
			super().verify()

		# Check if message contains required data
		try:
			body = json.loads(self.request.body)
		except:
			self.set_status(400)
			self.write({"error":400, "reason":"Unexpected data format. JSON required"})
			raise tornado.web.Finish
			
		if isinstance(body["message"], str):
			message = json.loads(body["message"])
		elif isinstance(body["message"], dict):
			message = body["message"]
		cid = int(message["offer_id"].get("cid", 0))
		buyer_address = message["offer_id"].get("buyer_address")
		coinid = message.get("coinid")

		if not all([cid, buyer_address, coinid]):
			self.set_status(400)
			self.write({"error":400, "reason": "Missed required fields."})
			raise tornado.web.Finish

		if coinid in settings.bridges.keys():
			self.account.blockchain.setendpoint(settings.bridges[coinid])
		else:
			self.set_status(400)
			self.write({"error":400, "reason":"Invalid coin ID"})
			raise tornado.web.Finish

		check = self.account.validator[coinid](public_key)

		account = await self.account.getaccountdata(public_key=public_key)
		if "error" in account.keys():
			error_code = account["error"]
			self.set_status(error_code)
			self.write(account)
			raise tornado.web.Finish
	
		# Check if one of sellers or buyers rejects offer
		owneraddr = await self.account.blockchain.ownerbycid(cid=cid)
		hex_ = check
		if buyer_address != hex_ and owneraddr != hex_:
			# Avoid rejecting offer
			self.set_status(403)
			self.write({"error": 403, "reason":"Forbidden. Offer does not belong to user."})
		
		# Reject offer
		response = await self.account.blockchain.rejectoffer(coinid=coinid, cid=cid, 
															buyer_address=buyer_address)
		if "error" in response.keys():
			self.set_status(response["error"])
			self.write(response)
			raise tornado.web.Finish

		# Get buyer for email sending
		buyer = await self.account.getaccountbywallet(wallet=buyer_address)
		if "error" in buyer.keys():
			self.set_status(buyer["error"])
			self.write(buyer)
			raise tornado.web.Finish
	
		if buyer.get("email"):
			emaildata = {
				"to": buyer.get("email"),
				"subject": "Robin8 support",
     			"optional": "Your offer with cid %s was rejected." % cid
			}
			await self.account.mailer.sendmail(**emaildata)
		
		# Undeposit balance
		price = await self.account.blockchain.getwriteprice(cid=cid)
		coinid = "PUT"
		await self.account.balance.unfreeze(uid=buyer["id"],coinid=coinid, 
													amount=price)

		del response["result"]
		self.write(response)
442850
def submit(para_temp)
      parameters = {
          "service" => "batch_trans_notify",
          "partner" => NewAlipay.partner,
          "notify_url" => para_temp[:notify_url],
          "email" => NewAlipay.seller_email,
          "account_name" => NewAlipay.account_name,
          "pay_date" => Time.new.strftime('%Y-%m-%d'),
          "batch_no" => random_trade_no(24),
          "batch_fee" => para_temp[:batch_fee],
          "batch_num" => para_temp[:batch_num],
          "detail_data" => para_temp[:detail_data],
          "_input_charset" => "utf-8"
      }
      parameters = parameters.merge({buyer_account_name: para_temp[:buyer_account_name]}) if para_temp[:buyer_account_name]

      signing_str_array = parameters.inject([]) { |memo, (key, v)| memo << "#{key}=#{v}"; memo }
      sorted_signing_str_array = signing_str_array.sort! { |m, n| m.to_s <=> n.to_s }
      sign = Digest::MD5.hexdigest(sorted_signing_str_array.join('&')+NewAlipay.key)

      sorted_signing_str_array << "sign=#{sign}" << 'sign_type=MD5'

      yield parameters.symbolize_keys.merge({:sign => sign, :sign_type => 'MD5'}) if block_given?

      "#{ALIPAY_GATEWAY_NEW}#{sorted_signing_str_array.join('&')}"
    end
878518
async def post(self, public_key=None):
		
		if settings.SIGNATURE_VERIFICATION:
			super().verify()

		try:
			body = json.loads(self.request.body)
		except:
			self.set_status(400)
			self.write({"error":400, "reason":"Unexpected data format. JSON required"})
			raise tornado.web.Finish
		if isinstance(body["message"], str):
			message = json.loads(body["message"])
		elif isinstance(body["message"], dict):
			message = body["message"]
		cid = message.get("cid")
		read_price = message.get("price")
		coinid = message.get("coinid")
		buyer_access_string = message.get("buyer_access_string")
	
		if not all([buyer_access_string, coinid, str(cid).isdigit()]):
			self.set_status(400)
			self.write({"error":400, "reason":"Missed required fields"})
			raise tornado.web.Finish

		# Set bridge url
		if coinid in settings.bridges.keys():
			self.account.blockchain.setendpoint(settings.bridges[coinid])
		else:
			self.set_status(400)
			self.write({"error":400, "reason":"Invalid coinid"})
			raise tornado.web.Finish 

		# Get cid price from bridge
		if not read_price:
			read_price = await self.account.blockchain.getreadprice(cid=cid)

		buyer_address = self.account.validator[coinid](public_key)
		owneraddr = await self.account.blockchain.ownerbycid(cid=cid)

		# Check if public key exists
		account = await self.account.getaccountdata(public_key=public_key)
		if "error" in account.keys():
			# If account does not exist
			self.set_status(account["error"])
			self.write(account)
			raise tornado.web.Finish

		#Get sellers balance
		balances = await self.account.balance.get_wallets(coinid=coinid, uid=account["id"])

		# Check if current content does not belong to current user
		if owneraddr == buyer_address:
			self.set_status(400)
			self.write({"error":400, 
						"reason":"Content belongs to current user"})
			raise tornado.web.Finish

		# Get difference with balance and price
		for w in balances["wallets"]:
			if "PUT" in w.values() or "PUTTEST" in w.values():
				balance = w

		difference = int(balance["amount_active"]) - int(read_price)
		if difference < 0:
			# If Insufficient funds
			self.set_status(402)
			self.write({"error":402, "reason":"Balance is not enough"})
			raise tornado.web.Finish

		# Send request to bridge
		offer_data = {
			"cid":cid,
			"read_price":read_price,
			"offer_type":0,
			"buyer_address": buyer_address,
			"buyer_access_string":buyer_access_string
		}
		response = await self.account.blockchain.makeoffer(**offer_data)
		try:
			response["error"]
		except:
			pass
		else:
			self.set_status(response["error"])
			self.write(response)
			raise tornado.web.Finish

		await self.account.insertoffer(cid=cid, txid=response["result"]["txid"], 
											coinid=coinid, public_key=public_key)
		# Send e-mail to seller
		seller = await self.account.getaccountbywallet(wallet=owneraddr)
		if "error" in seller.keys():
			self.set_status(seller["error"])
			self.write(seller)
			raise tornado.web.Finish

		if seller.get("email"):
			emaildata = {
				"to": seller["email"],
				"subject": "Robin8 support",
     			"optional": "You`ve got an offer for content %s." % cid
			}
			await self.account.mailer.sendmail(**emaildata)


		# Freeze price at balance
		coinid = "PUT"
		await self.account.balance.freeze(uid=account["id"],coinid=coinid, 
																amount=read_price)

		# Set fee
		fee = await billing.set_make_offer_fee(buyer_address=buyer_address)
		if "error" in fee.keys():
			self.set_status(fee["error"])
			self.write(fee)
			raise tornado.web.Finish

		response["offer_type"] = "read_access"
		del response["result"]		

		self.write(response)
312648
function create() {
		// Check form for errors
		if(!$("#privateKey").val() || !$("#recipient").val()) return alert('Missing parameter !');
		if(undefined === $("#amount").val() || !nem.utils.helpers.isTextAmountValid($("#amount").val())) return alert('Invalid amount !');
		if (!nem.model.address.isValid(nem.model.address.clean($("#recipient").val()))) return alert('Invalid recipent address !');

		// Set the private key in common object
		common.privateKey = $("#privateKey").val();

		// Check private key for errors
		if (common.privateKey.length !== 64 && common.privateKey.length !== 66) return alert('Invalid private key, length must be 64 or 66 characters !');
    	if (!nem.utils.helpers.isHexadecimal(common.privateKey)) return alert('Private key must be hexadecimal only !');

		// Set the cleaned amount into transfer transaction object
		transferTransaction.amount = nem.utils.helpers.cleanTextAmount($("#amount").val());

		// Recipient address must be clean (no hypens: "-")
		transferTransaction.recipient = nem.model.address.clean($("#recipient").val());

		// Set message
		transferTransaction.message = $("#message").val();

		// Prepare the updated transfer transaction object
		var transactionEntity = nem.model.transactions.prepare("transferTransaction")(common, transferTransaction, nem.model.network.data.testnet.id);

		// Create a key pair object from private key
		var kp = nem.crypto.keyPair.create(nem.utils.helpers.fixPrivateKey(common.privateKey));

		// Serialize the transaction
		var serialized = nem.utils.serialization.serializeTransaction(transactionEntity);

		// Sign the serialized transaction with keypair object
	    var signature = kp.sign(serialized);

	    // Build the object to send
	    var result = {
	        'data': nem.utils.convert.ua2hex(serialized),
	        'signature': signature.toString()
	    };

	    // Show the object to send in view
	    $("#result").val(JSON.stringify(result));
	}
492202
def account_update(self, data, **kwargs):
        ""
        api_path = "/api/v2/account"
        return self.call(api_path, method="PUT", data=data, **kwargs)
73710
def create_address(self, account_id, **params):
        """"""
        response = self._post('v2', 'accounts', account_id, 'addresses', data=params)
        return self._make_api_object(response, Address)
1189052
def create(self, id):
        
        resp = self.client.accounts.create(id=id)
        self.display(resp)
1092613
def newaccount(ctx, accountname, account, password):
    
    print_tx(
        ctx.bitshares.create_account(accountname, registrar=account, password=password)
    )
889291
def create(self, request, *args, **kwargs):
        """"""
        if not request.user.is_authenticated:
            raise exceptions.NotFound

        return super().create(request, *args, **kwargs)
649144
def register
      response_request = Request.post("transactions/cancels", api_version, params)
      Response.new(response_request, self).serialize
    end
866040
def request_create(self, data, **kwargs):
        ""
        api_path = "/api/v2/requests.json"
        return self.call(api_path, method="POST", data=data, **kwargs)
924310
def create(self,params=None, headers=None):
        
        path = '/creditor_bank_accounts'
        
        if params is not None:
            params = {self._envelope_key(): params}

        try:
          response = self._perform_request('POST', path, params, headers,
                                            retry_failures=True)
        except errors.IdempotentCreationConflictError as err:
          return self.get(identity=err.conflicting_resource_id,
                          params=params,
                          headers=headers)
        return self._resource_for(response)
1029401
function(service, service_id, auth_token) {
      Account.create({service: service, service_id: service_id, auth_token: auth_token})
      .then(function(account) {
        // cool beans
        Switchboard.delegateAccount('add', account.condensed());
        return true;
      })
      .fail(function(error) {
        hb.errors.emit('error', whatError(error.originalError));
        return false;
      });
    }
1244183
def deposit(self, account_id, **params):
        """"""
        for required in ['payment_method', 'amount', 'currency']:
            if required not in params:
                raise ValueError("Missing required parameter: %s" % required)
        response = self._post('v2', 'accounts', account_id, 'deposits', data=params)
        return self._make_api_object(response, Deposit)