英文:
Netsuite external Id error depending on externalid value
问题
I'm simply trying to upsert a contact in Netsuite using REST api, via Postman.
This contact is not present in NS, none of the tested external ids is.
I send this request
PUT {{REST_SERVICES}}/record/v1/contact/eid:a0A580000010LVvEAM
with body {
"customForm":"107",
"email":"user@example.com",
"externalId":"a0A580000010LVvEAM",
"firstName":"first",
"lastName":"Name",
"salutation":"Mrs.",
"subsidiary":2
}
The server returns this message :
{
"type": "https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.5",
"title": "Not Found",
"status": 404,
"o:errorDetails": [
{
"detail": "The record instance does not exist. Provide a valid record instance ID.",
"o:errorCode": "NONEXISTENT_ID"
}
]
}
which is already weird since an upsert, by definition, doesn't need an internal id nor an existent external id.
Now I tried to remove the last character from the extId, just to see what would happen :
PUT {{REST_SERVICES}}/record/v1/contact/eid:a0A580000010LVvEA
with body {
"customForm":"107",
"email":"user@example.com",
"externalId":"a0A580000010LVvEA",
"firstName":"first",
"lastName":"Name",
"salutation":"Mrs.",
"subsidiary":2
}
and I get my 204 No Content success return, the contact is inserted.
I then tried with a 'N' as 18th character instead of the 'M', it worked too.
I'm quite confused about this issue, why an external id would work and another one wouldn't ?
英文:
I'm simply trying to upsert a contact in Netsuite using REST api, via Postman.
This contact is not present in NS, none of the tested external ids is.
I send this request
PUT {{REST_SERVICES}}/record/v1/contact/eid:a0A580000010LVvEAM
with body {
"customForm":"107",
"email":"user@example.com",
"externalId":"a0A580000010LVvEAM",
"firstName":"first",
"lastName":"Name",
"salutation":"Mrs.",
"subsidiary":2
}
The server returns this message :
{
"type": "https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.5",
"title": "Not Found",
"status": 404,
"o:errorDetails": [
{
"detail": "The record instance does not exist. Provide a valid record instance ID.",
"o:errorCode": "NONEXISTENT_ID"
}
]
}
which is already weird since an upsert, by definition, doesn't need an internal id nor an existent external id.
Now I tried to remove the last character from the extId, just to see what would happen :
PUT {{REST_SERVICES}}/record/v1/contact/eid:a0A580000010LVvEA
with body {
"customForm":"107",
"email":"user@example.com",
"externalId":"a0A580000010LVvEA",
"firstName":"first",
"lastName":"Name",
"salutation":"Mrs.",
"subsidiary":2
}
and I get my 204 No Content success return, the contact is inserted.
I then tried with a 'N' as 18th character instead of the 'M', it worked too.
I'm quite confused about this issue, why an external id would work and another one wouldn't ?
答案1
得分: 1
说实话,你分享的所有内容听起来都非常奇怪;尽管我也见过NetSuite系统的一些奇怪行为,所以这并不令人意外。从我的角度来看,所有提到的情况都像是一个缺陷,但以下是一些建议:
1)如果你在URL中查询外部ID,是否真的需要将它作为请求体的参数包含进去?尽量保持简单,以减少出现这些问题的风险。
2)你尝试过根据你查询的外部ID运行一个保存的搜索吗?值得检查一下返回的错误信息是否正确(即“记录实例不存在”)。鉴于我们见过的奇怪行为,我认为我们有理由对NetSuite的Web服务失去信心。
3)当你使用“管理员”角色作为认证的一部分时,是否会得到相同的响应?检查角色/权限是否可能是行为异常的因素值得一试。
最后,我想补充一下,我一直避免使用PUT调用,而是坚持使用POST和PATCH。PUT在过去让我失望过很多次。
尽管这不是一个确定的答案,但希望以上建议对你有所帮助。
英文:
To be honest, everything you have shared sounds completely strange; although not surprising given that I have also seen strange behaviours of the NetSuite system. From my perspective, everything mentioned sounds like a defect, but here are some areas I would comment on:
-
If you are querying the external ID in the URL, is it actually necessary to include it as a parameter in your body? Keep things as simple as possible to reduce the risk of these problems.
-
Have you tried running a saved search based on the external ID you have queried? It's worth just checking that the error messages returned are actually correct (i.e. "The record instance does not exist."). Indeed, given the strange behaviours seen, I think we have reasonable grounds to lose confidence in NetSuite's web services.
-
Do you get the same responses when you are using the "administrator" roles as part of the authentication? It's worth just ruling out roles/permissions as a possible factor for the behaviour.
Lastly, I would add that I have always avoided using the PUT call and instead stick to POST and PATCH. PUT has let me down many times in the past.
Although not a conclusive answer, I hope the above might be of some help to you.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论