<rss version="2.0" xmlns:a10="http://www.w3.org/2005/Atom"><channel><title>Inflectra Customer Forums: REST API: POST to projects_projectid_test-sets_parameters (Thread)</title><description> My issue is regarding a POST operation to the REST API:  projects\{project_id}\test-sets\parameters  I find it impossible to create a test-set level test-case-parameter by using this REST API POST. The documentation is very unclear, but one would assume that I dont have to provide a TestCaseParameterId in the POST body because I am creating a new entity and this identifier should be created for me.  I get an error like this every time. I am passing TestSetId (and the Id is good), Name, and Value, but not TestCaseParameterId.  If I am really supposed to pass a TestCaseParameterId how am I supposed to get one?  After all, the entire point of the call is to create a new TestCaseParameter (at the test-set level) right? So how do I know its ID before it exists?  And if you do intend to assign an ID for me, shouldnt this REST call return the newly created entity so that I can find out what it is?    Request Error       The server encountered an error processing the request. The exception message is Database foreign key violation occurred. See server logs for more details. The exception stack trace is: at Inflectra.SpiraTest.Business.SpiraTestEntitiesEx.SaveChanges(SaveOptions options, Nullable`1 userId, Boolean updateHistory, Boolean sendNotification, Nullable`1 rollbackId)    Looking in the server logs as suggested turns up a little more detail:    Messages:Database foreign key violation occurred [APPLICATION.Business.EntityForeignKeyException]An error occurred while updating the entries. See the inner exception for details. [System.Data.UpdateException]The INSERT statement conflicted with the FOREIGN KEY constraint FK_TST_TEST_CASE_PARAMETER_TST_TEST_SET_PARAMETER. The conflict occurred in database SpiraTeam, table dbo.TST_TEST_CASE_PARAMETER, column TEST_CASE_PARAMETER_ID.The statement has been terminated. [System.Data.SqlClient.SqlException]            </description><language>en-US</language><copyright>(C) Copyright 2006-2026 Inflectra Corporation.</copyright><managingEditor>support@inflectra.com</managingEditor><category domain="http://www.dmoz.org">/Computers/Software/Project_Management/</category><category domain="http://www.dmoz.org">/Computers/Software/Quality_Assurance/</category><generator>KronoDesk</generator><a10:contributor><a10:email>support@inflectra.com</a10:email></a10:contributor><a10:id>http://www.inflectra.com/kronodesk/forums/threads</a10:id><ttl>120</ttl><link>/Support/Forum/spirateam/issues-questions/2647.aspx</link><item><guid isPermaLink="false">threadId=2647</guid><author>Bern McCarty (bern_mccarty@cinfin.com)</author><title>REST API: POST to projects_projectid_test-sets_parameters</title><description> My issue is regarding a POST operation to the REST API:  projects\{project_id}\test-sets\parameters  I find it impossible to create a test-set level test-case-parameter by using this REST API POST. The documentation is very unclear, but one would assume that I dont have to provide a TestCaseParameterId in the POST body because I am creating a new entity and this identifier should be created for me.  I get an error like this every time. I am passing TestSetId (and the Id is good), Name, and Value, but not TestCaseParameterId.  If I am really supposed to pass a TestCaseParameterId how am I supposed to get one?  After all, the entire point of the call is to create a new TestCaseParameter (at the test-set level) right? So how do I know its ID before it exists?  And if you do intend to assign an ID for me, shouldnt this REST call return the newly created entity so that I can find out what it is?    Request Error       The server encountered an error processing the request. The exception message is Database foreign key violation occurred. See server logs for more details. The exception stack trace is: at Inflectra.SpiraTest.Business.SpiraTestEntitiesEx.SaveChanges(SaveOptions options, Nullable`1 userId, Boolean updateHistory, Boolean sendNotification, Nullable`1 rollbackId)    Looking in the server logs as suggested turns up a little more detail:    Messages:Database foreign key violation occurred [APPLICATION.Business.EntityForeignKeyException]An error occurred while updating the entries. See the inner exception for details. [System.Data.UpdateException]The INSERT statement conflicted with the FOREIGN KEY constraint FK_TST_TEST_CASE_PARAMETER_TST_TEST_SET_PARAMETER. The conflict occurred in database SpiraTeam, table dbo.TST_TEST_CASE_PARAMETER, column TEST_CASE_PARAMETER_ID.The statement has been terminated. [System.Data.SqlClient.SqlException]            </description><pubDate>Wed, 20 Jul 2022 17:44:26 -0400</pubDate><a10:updated>2022-07-20T21:07:45-04:00</a10:updated><link>/Support/Forum/spirateam/issues-questions/2647.aspx</link></item><item><guid isPermaLink="false">messageId=5690</guid><author>David J (adam.sandman+support@inflectra.com)</author><title> The error is because you are missing a value for:   TestCaseParameterId   This is the ID of the par</title><description> The error is because you are missing a value for:   TestCaseParameterId   This is the ID of the parameter as defined on the test case, not its instance on the test set (which is what you are creating).  You would get the value by first calling this function on a specific test case:   GET: projects/{project_id}/test-cases/{test_case_id}/parameters     https://api.inflectra.com/Spira/Services/v6_0/RestServiceOperation.aspx?uri=projects%2f%7bproject_id%7d%2ftest-cases%2f%7btest_case_id%7d%2fparameters&amp;method=GET  </description><pubDate>Wed, 20 Jul 2022 21:07:45 -0400</pubDate><a10:updated>2022-07-20T21:07:45-04:00</a10:updated><link>/Support/Forum/spirateam/issues-questions/2647.aspx#reply5690</link></item></channel></rss>