ERPNext API: PUT not updating?

I’m trying to use the ERPNext API to Update a record in Postman.

The PUT only returns the data, and doesn’t update the record.

For example:

the erp . com/api/resource/Lead/CRM-LEAD-2022-00665

With a raw body of

 {
"status":"Lead"

    }

will return the Lead Record details, but it does not update the record.

Unfortunately, you may need to do some more troubleshooting. The PUT request you’ve got here works fine on my system (v14 latest stable release).

I can’t fathom what I would need to change…

Is there some option I need to enable inside ErpNext to allow records to be updated via REST?

There are no options; REST APIs are enabled automatically. The ERPNext UI itself leverages them.

My guess is that some business logic is preventing that particular Lead from changing its status. But without throwing an error. Somehow it’s just “skipping” the update, and returning back the JSON for the Lead.

I’m not familiar with Leads specifically. But I’ve definitely seen this happen with other DocTypes.

1 Like

I’m thinking I have something configured incorrectly in Postman (I can’t imagine what, though?).

When I send a Curl via PHP, it updates as expected. It’s just that when I try and send it via Postman that it won’t update…

May be, lack of permissions!

Try the same with tokens of administrator, it might work:

Authorization: token <api_key>:<api_secret>

If worked, replace tokens with user; and refine permissions for the users which needs to perform this operations.