我正在构建一个使用Upwork API的the服务。我一直在使用Send Client Offer调用,并编写了以下代码:
const Offers = require('upwork-api/lib/routers/hr/clients/offers.js').Offers;
var offers = new Offers(api);
var params = {
'title': 'this is a test',
'jobType': 'hourly',
'chargeRate': '20.0',
'messageToContractor': 'Please accept this test job',
'teamReference': '5051328',
'contractorReference': '~0120735c46bc72dc4f'
'related_jobcategory2': '1031626745110315008'
};
offers.makeOffer(params, function(error, data) {
if (error){
response(context, error.statusCode, 'api.sendClientOffer failed with: ' + JSON.stringify(error));
}
else {
ok(context, data);
}
});这会产生以下错误:
api.sendClientOffer失败,出现以下错误:
{"statusCode":400,"data":"{\"server_time\":1574402550,\"error\":{\"status\":\"400\",\"code\":\"1\",\"message\":\"FP2 offers should have at least one milestone defined.\"}}"}这是令人困惑的,因为里程碑应该只需要固定价格类型,而不是每小时。
添加milestones参数时:
‘里程碑’:{‘里程碑描述’:‘第一个里程碑’,‘存款金额’:10.0,‘到期日期’:‘12-15-2019’},{‘里程碑_描述’:‘第二个里程碑’,‘存款金额’:10.0,‘到期日期’:'12-23-2019'}
我得到的api.sendClientOffer失败的原因是:
{"statusCode":401,"data":"{\"server_time\":1574402693,\"error\":{\"status\":401,\"code\":401,\"message\":\"Verification of signature failed.\"}}"}getCompanies调用表明我可以访问我引用的团队,并且我的凭据可用于getUserInfo和searchFreelancers调用。有没有人有这个调用的node.js示例可以作为参考?我很难弄清楚这是身份验证错误还是验证错误。
发布于 2019-11-25 13:10:53
您使用的参数不正确,请查看https://developers.upwork.com/?lang=node#contracts-and-offers_send-client-offer上的此接口文档。没有jobType参数,它被称为job_type。其他人也是如此。
https://stackoverflow.com/questions/58988459
复制相似问题