Anyone have any tips on why a purchase order would...
# general
k
Anyone have any tips on why a purchase order would not transform to a vendor bill via REST? It says invalid token, but my API calls are working flawlessly everywhere else, and this is a generic error I've encountered in the past when the payload has issues, so I'm not buying it.
Copy code
{
  "request": {
    "method": "POST",
    "url": "https://<instance>.<http://suitetalk.api.netsuite.com/services/rest/record/v1/purchaseorder/2201922/!transform/vendorbill|suitetalk.api.netsuite.com/services/rest/record/v1/purchaseorder/2201922/!transform/vendorbill>",
    "headers": {
      "autoName": false,
      "Authorization": "scrubbed",
    },
    "body": {
      "item": {
        "items": [
          {
            "line": 2,
            "quantity": 1,
            "amount": "11"
          },
          {
            "line": 3,
            "quantity": 10,
            "amount": "40"
          },
          {
            "line": 4,
            "quantity": 8,
            "amount": "32"
          },
          {
            "line": 5,
            "quantity": 5,
            "amount": "28.75"
          },
          {
            "line": 6,
            "quantity": 5,
            "amount": "30"
          },
          {
            "line": 7,
            "quantity": 6,
            "amount": "20.4"
          }
        ]
      }
    }
  },
  "response": {
    "statusCode": 401,
    "headers": {
      "content-type": "application/vnd.oracle.resource+json; type=error; charset=UTF-8",
      "content-length": "328",
      "x-n-operationid": "d2d4b980-aebc-48ed-96fb-1dff033ad105",
      "ns_rtimer_composite": "1822813119:706172746E6572733230372E70726F642D7068782D6E61352E636F72652E6E732E696E7465726E616C:80",
      "strict-transport-security": "max-age=31536000",
      "pragma": "No-Cache",
      "cache-control": "No-Cache",
      "expires": "0",
      "www-authenticate": "OAuth realm=\"scrubbed\", error=\"token_rejected\", error_description=\"Invalid login attempt.\"",
      "p3p": "CP=\"CAO PSAa OUR BUS PUR\"",
      "vary": "User-Agent",
      "date": "Tue, 21 Mar 2023 19:48:52 GMT",
      "connection": "close",
      "set-cookie": [
        "NS_ROUTING_VERSION=LAGGING; path=/"
      ],
      "akamai-grn": "0.5e472317.1679428130.2e19a88c"
    },
    "body": {
      "type": "<https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.2>",
      "title": "Unauthorized",
      "status": 401,
      "o:errorDetails": [
        {
          "detail": "Invalid login attempt. For more details, see the Login Audit Trail in the NetSuite UI at Setup > Users/Roles > User Management > View Login Audit Trail.",
          "o:errorCode": "INVALID_LOGIN"
        }
      ]
    }
  }
}
I've confirmed Full permissions for Vendor Bill, Purchase Order, and Bill Purchase Order
b
what does the login audit trail say
k
InvalidSignature
But the authorization code is from a NS library and working elsewhere
b
which library
k
b
that uses oauth-1.0a, which is a reasonable package
id say trying using oauth-1.0a directly, the maintainer of netsuite-tba-oauth doesnt know how to publish to npm anymore and so it has versioning problems
k
Will give it a shot. Do you know by any chance, are the required permissions for transforming a record documented somewhere?
I'd like to validate that as well..
b
basically the same as doing it in the ui
the rest api is generally fairly helpful and will tell you which permission you are missing
k
Ok, thanks for your help, I will try another auth library and go from there.
Update, my implementation of OAuth was using urlEncode for the url, which does not encode
!
, but this is a reserved character for the RFC spec that NetSuite sites. I've had to find and replace that character, specifically to call the !transform function. Thanks again for pointing me in the right direction!