나는 데 문제가 업데이트 제품에서 Shipstation.
내가 사용하고 이들 2 의 링크를 참조 나는 어떻게해야 하는 형식의 응답:
https://www.shipstation.com/docs/api/products/update/ https://www.any-api.com/shipstation_com/shipstation_com/docs/Products/_products_productId_/PUT
내가 다음과 같은 그것을 정확하게,그러나 나는 항상 500 오류 메시지"말하는 개체는 참조되지 않을 설정하는 개체의 인스턴스".
었을 사용하여 얻을 요청하 제품의 특성이 있습니다.
그 후 업데이트 속성을 변경할 필요가 있는,그리고에 저장 data
(는 개체의 배열). 그때 사용하는 요청이 데이터를 전송합니다.
이것은 관련 코드:
function updateProducts(authString, data) {
var baseProductUrl = `https://ssapi.shipstation.com/products/`;
for(var d = 0; d < data.products.length; d++) { //for each product I'd like to update...
var raw = data.products[d];
raw = JSON.stringify(raw);
var requestOptions = {
method: 'PUT',
headers: {
"Authorization": `Basic ${authString}`,
"Content-Type": `application/json`,
},
body: raw,
redirect: 'follow'
};
var productUrl = `${baseProductUrl}${data.products[d].productId}`;
UrlFetchApp.fetch(productUrl, requestOptions);
}
}
이것은 무엇인 raw
(데이터 전송을 ShipStation)처럼 보인:
Null 값은 단순히 내가에서 받는 GET 요청을 합니다. 나는 그들을 좋아한 속성이 편 비어 있습니다.
{"aliases":null,
"productId":123456789, //placeholder
"sku":"sku", //placeholder
"name":"UV Bulb - 1GPM - 10\"",
"price":19.99,
"defaultCost":null,
"length":2,
"width":2,
"height":13,
"weightOz":7,
"internalNotes":null,
"fulfillmentSku":null,
"active":true,
"productCategory":null,
"productType":null,
"warehouseLocation":null,
"defaultCarrierCode":null,
"defaultServiceCode":null,
"defaultPackageCode":null,
"defaultIntlCarrierCode":null,
"defaultIntlServiceCode":null,
"defaultIntlPackageCode":null,
"defaultConfirmation":null,
"defaultIntlConfirmation":null,
"customsDescription":"UV Bulb - 1GPM - 10\"", //attribute I'd like to update
"customsValue":9.99, //attribute I'd like to update
"customsTariffNo":null,
"customsCountryCode":"US",
"noCustoms":null,
"tags":null}
그래서 사람이 어떤 힌트를,또는 누군가 사용 ShipStation 의 API 전 및 완료를 넣어 요청이 있으십니까? 나는 무엇이 없는가?