I couldn't get POSTMAN working with just the NS to...
# suitescript
c
I couldn't get POSTMAN working with just the NS token details which my was litmus test - doubt their system supports oauth
b
Perhaps they require you to install their integration record first
c
@battk I wish!
They don't have anything to do with NetSuite
THey're just asking for a callback URL to send fulfilments to and two auth values: USER, SECRETY KEY
So that can only be TBA or username / password (which would require NLAUTH headers I believe).
b
Probably want to get clarification
They might mean oauth 2
c
I thought OAUTH 2 would require more than just two fields to authenticate?
OR maybe not - I'll play around with that.
b
if you skip to the end, you only need the access token
if you start at the beginning, then the client id and secret can be used in a browser redirect based flow to get the access token
and refresh token in netsuite's case
p
In the past I’ve just used a without login suitelet & hard-coded an API key that you ask them to put in the URL. Fast fail in the script if it isn’t set correctly. Not elegant, but does the job because you’re not dealing with returning data
c
@PNJ How did you do that?
I'm hoping I don't have to resort to a bit of a hack but it might be necessary!
p
It's really simple. Like I said, I needed something quick & there was 0 risk involved with the data we were handling.
Get them to call the suitelet with
&apikey=abcdefghijklwhatever
appended in the URL then check it in the suitelet:
Copy code
function onRequest(context) {
	if (context.request.method === 'GET') {
		if (context.request.parameters.apikey=='abcdefghijklwhatever') {
			// do stuff 
		} else {
			log.debug('sweet let', 'DENIED');
		}
	}
	else
	{
		log.debug('sweet let','bad request type');
	}

	return true;
}
In your case you'd have to adapt it for
POST
unless the data is small and you can use other
GET
parameters easily (though obviously they get saved in any naughty MITM proxies along the way)
c
@PNJ thanks - looks like the sender cannot do anything other than HTTP basic
and they can't add anything to the headers
frustrating!
b
if you are desperate, you can probably badly implement http basic in an external suitelet
assuming they arent doing the actual challenge part of basic that nobody does anymore
c
What a pain - that will be my backup if all else fails
@battk it turns out the sender ONLY support HTTP BASIC and sending PLAINTEXT
so I can't even use celigo as that has to be JSON
looks like my only option is what you suggested.
p
Crikey. I’d probably ask them when they planned on moving on from 1990s technology
c
Yeah....
This is stopping go live on this NetSuite / 3PL integration
p
This actually might be a good use case for something like AWS Lambda - use it as a stateless bridge that forwards the call on
c
@PNJ AWS was my next port of call, it does mean budget approval plus the ops team having to monitor that service on top of all the other services though.
m
@Craig, I see the ticket you raised. Perhaps you could use MyAPI which I think would allow you to customize a response. See https://docs.celigo.com/hc/en-us/articles/360047267771-What-is-My-API-. You’d just need to write a little JS hook to return the synchronous response that you want, and that same script could then invoke other flows etc. via the integrator.io API. Happy to help explain that further if needed.