Skip to content

Instantly share code, notes, and snippets.

{
"name": "Upload file",
"request": {
"url": "https://test.com/api/projects/1216/files",
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "Content-Type: multipart/form-data",
"description": ""
var xhr = (window.XMLHttpRequest) ? new XMLHttpRequest() : new activeXObject("Microsoft.XMLHTTP");
var boundary = '---------------------------' + (new Date).getTime(), //boundary is used to specify the encapsulation boundary of a parameter
data = "--" + boundary + "\r\n";
data += 'Content-Disposition: form-data; name=file; filename=PL International Test (2) (1) - Page 1; Content-Type=text/csv;\r\n\r\n'; //here we specify the name of the parameter name (data) sent to the server which can be retrieved by $_POST['data']
data += 'file_names=[{\"upload_id\":\"\",\"file_name\":\"PL International Test (2) (1) - Page 1\"}], \r\n'
data += 'My Project' + "\r\n";
data += "--" + boundary + "--\r\n";
xhr.open('post', 'https://test.com/api/projects/' + 4079 + '/user_upload_files?smart-suggest=true&update=true', true);
xhr.setRequestHeader('Content-Type', 'multipart/form-data; boundary=' + boundary);
xhr.setRequestHeader('X-AUTH-TOKEN', token);
import Vue from 'vue';
import Component from 'vue-class-component';
import ComponentA from './ComponentA.vue';
import ComponentB from './ComponentB.vue';
@Component({
components: {
ComponentA,
ComponentB,
if (transactionData.executedQuantity === transactionData.pendingQuantity) {
transactionData.pendingTransactionUpdateData = {
price: +transactionData.price,
payload: transactionData.payload,
trade_at: transactionData.trade_at,
settlement_at: transactionData.settlement_at
}
transactionData.cashTransactionUpdateData = {
executeTransaction: function(transactionId, data = {}, t) {
data.status = constants.TRANSACTION_STATUS_EXECUTED;
return await(models.Transactions.update(data,
{
where: {
id: transactionId
}
}, {transaction: t}));
}