Creates a new switch for a Survey

Request Parameters

Name Type Description Required?
SurveyIdSystem.Int32UnavailableNot Required
ScreenIdSystem.Int32UnavailableNot Required
DataLayoutElement[]UnavailableRequired
ProjectIdSystem.Int32UnavailableRequired
ProjectIdSystem.Int32UnavailableRequired

Validation

Name Type Description Required?
ProjectIdSystem.Int32IdRequired

Endpoints

Sample Request
 <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:api="http://api.phoenixplatform.net" xmlns:tig="http://schemas.datacontract.org/2004/07/Tigerspike.Phoenix.Services" xmlns:arr="http://schemas.microsoft.com/2003/10/Serialization/Arrays" xmlns:tig1="http://schemas.datacontract.org/2004/07/Tigerspike.Phoenix.Services.Filters">
    <soapenv:Header>
      <PhoenixHeader xmlns="http://api.phoenixplatform.com" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
         <AccessToken>[YOUR ACCESS TOKEN]</AccessToken>
         <Phoenix-ProjectId>1</Phoenix-ProjectId>
      </PhoenixHeader>
   </soapenv:Header>
   <soapenv:Body>
      <api1:CreateLayoutElement xmlns:api1="http://api.phoenixplatform.com">
         <api1:request>
             <tig:Id>1</tig:Id>
             <tig:SurveyId>1</tig:SurveyId>
             <tig:LayoutElementTypeId>Linear</tig:LayoutElementTypeId>
             <tig:ScreenId>1</tig:ScreenId>
             <tig:Rank>1</tig:Rank>
             <tig:ElementId>1</tig:ElementId>
             <tig:Contents>TestValue[3201a6471dcf4f9cb88565cc334bbbc3]</tig:Contents>
             <tig:LoadKey>TestValue[96de062dbe36467e9fc267459973283e]</tig:LoadKey>
             <tig:CreateDate>2018-12-16T11:50:53.3738124+00:00</tig:CreateDate>
             <tig:ModifyDate>2018-12-16T11:50:53.3738124+00:00</tig:ModifyDate>
         </api1:request>
      </api1:CreateLayoutElement>
   </soapenv:Body>
</soapenv:Envelope>
Sample Response
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
   <s:Header>
      <ActivityId CorrelationId="d088e8c6-bf1e-4a9d-9e96-3f5faf232af5" xmlns="http://schemas.microsoft.com/2004/09/ServiceModel/Diagnostics">17abb643-6b2f-4485-b4ff-0afc30697b7d</ActivityId>
   </s:Header>
   <s:Body>
      <SurveyResponse xmlns="http://api.phoenixplatform.com">
         <SurveyResult xmlns:a="http://schemas.datacontract.org/2004/07/Tigerspike.Phoenix.Syndicate.Services.Contracts.Article" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
            <b:Data xmlns="http://schemas.datacontract.org/2004/07/Tigerspike.Phoenix.Services" xmlns:b="http://schemas.datacontract.org/2004/07/Tigerspike.Phoenix.Survey.Model">
              <b:LayoutElement>
                <b:CreateDate>2018-12-16T11:50:53.3738124Z</b:CreateDate>
                <b:ModifyDate>2018-12-16T11:50:53.3738124Z</b:ModifyDate>
                <b:Rank>0</b:Rank>
                <b:ScreenId>0</b:ScreenId>
  </b:LayoutElement>
</b:Data>
            <TotalRecords xmlns="http://schemas.datacontract.org/2004/07/Tigerspike.Phoenix.Services">1</TotalRecords>
         </SurveyResult>
      </SurveyResponse>
   </s:Body>
</s:Envelope>
Resource URL

Sample Request

POST /projects/{projectId}/surveys/{surveyId}/screens/{screenId}/elements? HTTP/1.1
Accept-Encoding: gzip,deflate
Content-Type: application/json; charset=utf-8
Authorization: Bearer [YOUR SUPER SECURE TOKEN]
Content-Length: 706
Host: [CallHost]
Connection: Keep-Alive
User-Agent: Apache-HttpClient/4.1.1 (java 1.5)-
 
[{
 "Id" : 1,
 "SurveyId" : 1,
 "LayoutElementTypeId" : "Linear",
 "ScreenId" : 1,
 "Rank" : 1,
 "ElementId" : 1,
 "Contents" : "TestValue[8657e02ec36740e69fd38bf4e18ede55]",
 "LoadKey" : "TestValue[fab8a97eac0745c6a3abb8bc4dff8c73]",
 "CreateDate" : "2018-12-16T11:50:53.3738124+00:00",
 "ModifyDate" : "2018-12-16T11:50:53.3738124+00:00"
}] 
Sample Response
HTTP/1.1 200 OK
Cache-Control: private
Content-Length: 200
Content-Type: application/json; charset=utf-8
Server: Microsoft-IIS/8.5
X-AspNet-Version: 4.0.30319
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: GET,PUT,POST,DELETE,OPTIONS
Access-Control-Allow-Headers: Content-Type

[{
  "ScreenId": 0,
  "Rank": 0,
  "CreateDate": "2018-12-16T16:24:51.0063437Z",
  "ModifyDate": "2018-12-16T16:24:51.0063437Z"
}]

Nuget

PM> Install-Package PhoenixServiceHelper

PhoenixServiceHelper Sample

using System;
using System.Collections.Generic;

using Tigerspike.Phoenix.Services.Api.ServiceConfiguration;
using Tigerspike.Phoenix.Services.Api.ServiceRequest;
using PhoenixService = Tigerspike.PhoenixSurvey.V1;
using Tigerspike.Phoenix.Services.Api;

var request = new SoapServiceRequest() { Token = "[YOUR SUPER SECURE TOKEN]", ProjectId = 1 };
var configuration = CustomConfigurationFactory.CreateServiceConfiguration(Assembly.GetExecutingAssembly());

var proxy = new PhoenixServiceHelper<PhoenixService.IPhoenixSurveyService>(configuration);
var response = proxy.Execute(request, o => o.CreateLayoutElement(new PhoenixService.CreateLayoutElementRequest() 
{ 
    Data = new[] 
    { 
        new PhoenixService.LayoutElement() 
        {
          Id = 1,
          SurveyId = 1,
          LayoutElementTypeId = PhoenixService.LayoutElementTypeEnum.Linear,
          ScreenId = 1,
          Rank = 1,
          ElementId = 1,
          Contents = "TestValue["Guid.NewGuid().ToString().Replace("-",string.Empty)+"]",
          LoadKey = "TestValue["Guid.NewGuid().ToString().Replace("-",string.Empty)+"]",
          CreateDate = DateTime.UtcNow,
          ModifyDate = DateTime.UtcNow
        }
    } 
}));