Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save psapir/492ba2d43687ae721aa4b22190292060 to your computer and use it in GitHub Desktop.
Save psapir/492ba2d43687ae721aa4b22190292060 to your computer and use it in GitHub Desktop.
Writing a REST Service with Cloud Pages - PUT Method
If @action=="put" and not empty (@entrycode) and not empty(@Email) and not empty(@Lname) and not empty (@Name) and not empty (@phone) then
Set @rowsAffected = UPSERTDATA("Register",1,"EmailAddress", @Email,"EntryCode",@entrycode,"FirstName",@Name,"LastName",@Lname,"PhoneNumber",@phone)
If (@rowsAffected >0) then
set @Json= '{"status": "ok","message": "Your information was saved correctly"}'
output(v(@Json))
Endif
if(@rowsAffected ==0)then
set @Json= '{"status": "Error","message": "Invalid EntryCode"}'
output(v(@Json))
endif
endif
Endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment