MS Rest API - Update the member using ID Answered

Post author
Rhuel Gar

Hi everyone, just looking for some help using the memberstack rest api, I've been running into some issues updating members whenever they sign up.

I've setup a webhook sending new member data to my application on the member.created event, and upon receiving that member data, my application will modify some of the fields on the user, one of which is incrementing a number field relative to the newest member.

My issue comes when trying to update the member using the ID given to me, I'm making a PATCH request using the fetch api and getting a 200 from the server, but the neither the response nor the member in memberstack has the new custom fields set.

The fields already exist, but they are still empty. I may be making the request wrong, would appreciate some help

Comments

5 comments

  • Comment author
    Tyler Bell

    add content-type: application/json to your fetch request.
    And then don't stringify your data variable

    that might fix the problem.

    0
  • Comment author
    Rhuel Gar

    Ah, will try that

    I got a bad request with it unstringified, which makes sense, but sending the data with the header and stringifying it worked perfectly. Thanks, can't believe I didn't catch that.

    0
  • Comment author
    Tyler Bell

    ah got it. glad you got it working!

    0
  • Comment author
    Rhuel Gar

    Yep, I used the npm package for a different automation, and it worked very well. I wasn't able to use it here however since we are running this on a cloudflare worker.

    0
  • Comment author
    Tyler Bell

    very cool!

    Cloudflare workers are great.

    0

Please sign in to leave a comment.