We are using REST WebServices and I am testing to update an employee record's email address via POSTMAN.

HTTP method: PUT

Endpoint: https://<accountid>.suitetalk.api.netsuite.com/services/rest/record/v1/employee

JSON body:

{
    "email": "[email protected]"
}

Once this is send, system gives the error of UNSUPPORTED HTTP METHOD. below is the error responce:

{
    "type": "https://www.rfc-editor.org/rfc/rfc9110.html#section-15.5.6",
    "title": "Method Not Allowed",
    "status": 405,
    "o:errorDetails": [
        {
            "detail": "Unsupported HTTP method for the requested resource.",
            "o:errorCode": "INVALID_METHOD"
        }
    ]
}

Although I'm able to update the employee record through PATCH method,(and I tried using PUT in RESTlets and it works there), I need to know if the PUT method is not supported in NetSuite REST Webservices or I m doing something wrong?

2

There are 2 best solutions below

3
On

Your endpoint needs to include the employee ID to identify the record you want to modify. Without this, only GET (returns a list) or POST (creates new record) are valid.

GET /employee (Get list of records.)

POST /employee (Insert record.)

PUT /employee/{id} (Insert or update record.)

More information in the NetSuite REST API Browser documentation

0
On

All troubles come from NetSuite's document NetSuite REST API Browser: Record API v1 because it gives you example as follows:

PUT /employee/{id} (Insert or update record)

So firstly you need to notice that id is an external ID for upsert (not internal like for others), secondly you need to know how to use external ID, because the document Using the Upsert Operation is more exact:

PUT /employee/eid:{externalId}

So probably all is about missing prefix eid in request path. It works also for GET requests:

GET /employee/eid:{externalId}