Page tree
Skip to end of metadata
Go to start of metadata

The below API demonstrates two update queries. As update queries do not return any meaniful information, below API uses Text tag to 

send back the feedback submitted.

Feedback POST request with Text Tag
<?xml version="1.0" encoding="UTF-8" ?>
<Resource xmlns="http://xml.metamug.net/resource/1.0" v="1.0">
	<Request method="POST">
	    <Param name="source" type="text" value="feedback"/>
	    <Sql id="addFeedback" type="update">
          INSERT into feedback (name,email,issue,description) VALUES 
          ($name,$email,$issue,$description) 
      	</Sql>
      	<Sql id="addUser" type="update"> 
          	INSERT IGNORE INTO feedback_user(emailUsers,registration_source) VALUES ($email,$source)
      	</Sql>
      <Text id="feedback">
      	name: $name,feedback: $issue - $description
      </Text>
	</Request>
</Resource>


Inserting Duplicate Records

addUser  ignores duplicate inserts preventing the POST API from failing in case the user already exists in the table.

https://stackoverflow.com/questions/548541/insert-ignore-vs-insert-on-duplicate-key-update

  • No labels