RE: POST/PATCH + REST API

Hey there- New to the NetSuite API here. I can perform a GET against an employee ID without issue, but I’m having a difficult time debugging why I cannot perform a POST/PATCH in my same script.

I can do a POST/PATCH using Postman (with the same credentials) which I find odd. Has anyone experienced this before? If anyone has I’d be happy to share more details.

derekritchison Rookie Asked on December 13, 2022 in SuiteTalk.
Add Comment
1 Answers

I figured this out. The $body variable needs to be constructed in a very very specific way.

Rookie Answered on December 13, 2022.

Could you share that very very specific way?

on December 14, 2022.
 $body = "{    `n`"custentity_coupa_emp_id`": `"$employee_id`",    `n`"email`": `"$email`",    `n`"externalId`": `"$email`",    `n`"firstname`": `"$first`",    `n`"giveAccess`": false,    `n`"hireDate`": `"$start_date`",    `n`"lastname`": `"$last`",    `n`"subsidiary`": 1,    `n`"title`": `"$title`"`n}" 
on January 5, 2023.

The above works, but I’m still trying to figure out how to construct the “roles” in that body.

on January 5, 2023.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.