You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A clear and concise description of what the bug is.
When using the reserved character '!', in a path segment, it returns a 401 unauthorized error.
Example:
https://.suitetalk.api.netsuite.com/services/rest/record/v1/purchaseOrder//**!**transform/vendorBill
Note: this is similar to Issue#2126. However, in that case, they were using special characters in the query parameters. However, here we are using reserved characters in the URL path segments.
To Reproduce
Note that when using postman, this end point works: https://.suitetalk.api.netsuite.com/services/rest/record/v1/purchaseOrder/30356/**!**transform/vendorBill
In C#, I am using the RestSharp library to handle authentication.
Note that we are already successfully using RestSharp to call many different NetSuite endpoints using OAuth1 authentication.
However, for this particular end point, we believe the "!" in the URL may not be handled properly.
This seems to be the only difference in this particular case.
This is the code to reproduce the issue:
private static RestRequest GenerateRestRequest(OAuthCredentials oAuthCredentials, string urlPathSegments, Method requestMethodType)
{
var authenticator = OAuth1Authenticator.ForAccessToken(
oAuthCredentials.ConsumerKey,
oAuthCredentials.ConsumerSecret,
oAuthCredentials.TokenID,
oAuthCredentials.TokenSecret,
OAuthSignatureMethod.HmacSha256
);
authenticator.Realm = oAuthCredentials.AccountID;
RestRequest request = new RestRequest(Url.Combine(oAuthCredentials.CompanyURL, urlPathSegments), requestMethodType)
{
Authenticator = authenticator
};
return request;
}
public static async Task<RestResponse> NetSuiteTransformPOToVendorBill(this RestClient restClient, OAuthCredentials oAuthCredentials, NetSuiteVendorBill netSuitePOToVendorBillTransform, string NetSuitePOInternalID)
{
string segmentStr = "{segment}";
RestRequest request = GenerateRestRequest(oAuthCredentials, $"services/rest/record/v1/purchaseOrder/{NetSuitePOInternalID}/{segmentStr}/vendorBill", Method.Post);
// I believe the "!" mark in this segment may not be handled correctly when generating the nonce or signature
request.AddUrlSegment("segment", "!transform", false);
// Note: I have tried setting encoding to "true" as well
// request.AddUrlSegment("segment", "!transform", true);
request.AddHeader("Content-Type", "application/json");
request.AddHeader("prefer", "transient");
string serializedNetSuiteVendorBill = JsonConvert.SerializeObject(netSuitePOToVendorBillTransform);
request.AddJsonBody(serializedNetSuiteVendorBill);
return await restClient.ExecuteAsync(request);
}
Expected behavior
Returns Status: 204 No Content in Postman
A clear and concise description of what the bug is.
When using the reserved character '!', in a path segment, it returns a 401 unauthorized error.
Example:
https://.suitetalk.api.netsuite.com/services/rest/record/v1/purchaseOrder//**!**transform/vendorBill
Note: this is similar to Issue#2126. However, in that case, they were using special characters in the query parameters. However, here we are using reserved characters in the URL path segments.
To Reproduce
Note that when using postman, this end point works: https://.suitetalk.api.netsuite.com/services/rest/record/v1/purchaseOrder/30356/**!**transform/vendorBill
In C#, I am using the RestSharp library to handle authentication.
Note that we are already successfully using RestSharp to call many different NetSuite endpoints using OAuth1 authentication.
However, for this particular end point, we believe the "!" in the URL may not be handled properly.
This seems to be the only difference in this particular case.
This is the code to reproduce the issue:
Expected behavior
Returns Status: 204 No Content in Postman
Stack trace
error="token_rejected",
error_description="Invalid login attempt."
"title":"Unauthorized"
"status":401
Desktop (please complete the following information):
Additional context
The text was updated successfully, but these errors were encountered: