This topic contains 4 replies, has 0 voices, and was last updated by CREECE 7 years, 9 months ago.
-
AuthorPosts
-
January 29, 2017 at 1:37 am #1228
CREECEHello,
I have a 2.X RESTlet that has a delete handler and a 2.X User Event that calls the RESTlet. For create (put via https.put), update (post vis https.post) the User Event and RESTlet work fine. For delete, I am using https.delete with the URL appended (as it has no body) with params such as https:
&name=chris&id=12345 as defined in the examples. My URLS all look correct but when I log out context.name or context.id or context in general on the RESTlet side, I get no output. I would expect “chris” for the name and “12345” for the id and SOMETHING in the context but I just get {} for context and no output for anything else. I have also tried using url.format and that gave me the same results. It also doesn’t even seem like it is reaching my delete statement w/ the url with the extra params on it. I have triple checked that each one is & = . This seems like a super straight forward example so I am a bit confused as to why it isn’t working as described in documentation. Resolution:
I had oauth headers for the post/put using the url without parameters then trying to use that url with get/delete. Obviously this url wouldn’t have the parameters in it so my oauth was incorrect. Once I added the url with params when generating oauth headers everything worked fine.
Thanks
This is a cached copy. Click here to see the original post. -
January 30, 2017 at 8:09 am #1229
david.smithYou’re using reserved parameter names.
-
January 30, 2017 at 10:54 am #1230
CREECEBad example on my part with id/name.
Using TBA…
My headers type on both of these is
headers[‘Content-Type’] = ‘application/json’; Ive tried plaintext as well but same thing.
URL I am using:
Code:
https://rest.na1.netsuite.com/app/site/hosting/restlet.nl?script=&deploy=&creecetetestid=537Added on a creecetestid which i would expect to see on the rest.
Call to restlet:
Code:
return https.delete({ url: (nsURL + ‘&creecetestid=’ + ), headers: headers });
Restlet gets 0 data. I even have just a simple log statement in my function and nothing is logged. However, if i take off the extra param and just useURL:
Code:
https://rest.na1.netsuite.com/app/site/hosting/restlet.nl?script=&deploy=Code:
return https.delete({ url: nsURL, headers: headers });
Restlet logs as I would expect but with no data obviously as nothing was passed in the URL. So why would my first example fail? It seems like adding ANY additional params to the URL causes the restlet to not even be called. I have my UE code in a try/catch and no errors are thrown so I am a bit lost honestly.Update:
Using both NLAuth and TBA, I am able to successfully call my delete with the URL params. I hardcoded the url in my calling code and still nothing happens for some reason. So now there’s a difference between POSTman and however https.delete is working.
-
January 30, 2017 at 2:15 pm #1231
david.smithThe delete doesn’t return anything. That’s a lot of times why I will forgo the GET/PUT/DELETE and just use POST with a param like “func” or “action” or “operation”. There is no confirmation response.
-
January 30, 2017 at 2:22 pm #1232
CREECESigh… I’m dumb. I had oauth headers for the post/put using the url without parameters then trying to use that url with get/delete. Obviously this url wouldn’t have the parameters in it so my oauth was incorrect. Once I added the url with params when generating oauth headers everything worked fine.
-
AuthorPosts
You must be logged in to reply to this topic.