Hi:slightly_smiling_face:, I’ve been working on bu...
# suitetalkapi
s
Hi🙂, I’ve been working on building an integration which sends http requests to RESTlets but I’m a fairly new to the netsuite platform, and having a bit of trouble. I’ve been trying figure out how to construct the signature in the authorization header of the http request properly so I’ve been following this tutorial https://docs.oracle.com/en/cloud/saas/netsuite/ns-online-help/section_1534941088.html#The-Signature-for-Web-Services-and-RESTlets . I am able to generate matching signatures with the given base strings and keys for the REST web services example and the SOAP web services example, but not for the RESTlet example. The closest I’ve come to matching the given signature in the example is
+KK4SKNgz4ZiILGLwOMtfYlgcXSy1eis8ldE9X90azQ=
. I was able to achieve this by changing the base string example to the format to
<method>&<URL>&<parameters>
with ‘&’ delimiters instead of ‘%’ symbols. Using the base string as its given returns
Ag+D4okYPrkQsPFLIWpuDV/Z/Im2WNLvboMjwt5SOMY=
. I am generating my signature at the moment by simply using the given base string and key, and feeding them in to this command
$(echo -n $BASE_STRING | openssl dgst -sha256 -hmac $KEY -binary | base64)
but I’ve also tested in java and python, and achieved the same result. I’m sure I’m doing something obviously incorrect, but has anyone worked through this tutorial and had success (and might be able to offer some advice)?
s
RESTlet and REST should be the same way to encode the auth token, I use the same code interchangeably
s
Thanks for the tip! I must be close then.
s
Also, if there are spaces in your request params, one thing I found is they have to be encoded as actual space, not uriencoded as +
m
Examples in python
s
Thanks Michoel, this is really helpful. I did eventually figure out where I was going wrong, but I’m going to keep this bookmarked as a resource. By the way, I owe you a coffee. Your ‘Netsuite Field Explorer’ chrome extension has been such a help to me.
👌 1
❤️ 1
p
@michoel i've sent you some issues on netsuite field explorer github, have you seen them by chance?