Created
August 3, 2017 15:06
-
-
Save psapir/d0cc057107269d1a282f1e27e36c284d to your computer and use it in GitHub Desktop.
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
%%[ | |
var @action,@entrycode,@Json,@JsonNotFound,@EmailAddress,@FristName,@LastName,@phone,@rowCount,@row,@rows | |
set @action=Requestparameter("action") | |
set @entrycode=Requestparameter("entrycode") | |
set @JsonNotFound=' {"status": "error","message": "Could not find record with entrycode" }' | |
If @action=="get" and not empty (@entrycode) then | |
set @rows = LookupRows("Register","EntryCode",@entrycode) | |
set @rowCount = rowcount(@rows) | |
If@rowCount==0 then | |
output(v(@JsonNotFound)) | |
endif | |
If @rowCount > 0 then | |
set @row = row(@rows,1) | |
set @EmailAddress = field(@row,"EmailAddress") | |
set @FristName = field(@row,"FirstName") | |
set @LastName = field(@row,"LastName") | |
set @phone = field(@row,"PhoneNumber") | |
set @Json= '{"status": "ok","data": {"EntryCode":"' | |
set @Json= concat(@Json,@entrycode,'","email": "',@EmailAddress) | |
set @Json= concat(@Json,'","firstName":"',@FristName) | |
set @Json= concat(@Json,'","lastName":"',@LastName) | |
set @Json= concat(@Json,'","phoneNumber":"',@phone,'"}') | |
set @Json= concat(@Json,'}') | |
output(v(@Json)) | |
endif | |
endif | |
]%% |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment