Created
August 3, 2017 15:14
-
-
Save psapir/492ba2d43687ae721aa4b22190292060 to your computer and use it in GitHub Desktop.
Writing a REST Service with Cloud Pages - PUT Method
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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