Select your cookie preferences

We use essential cookies and similar tools that are necessary to provide our site and services. We use performance cookies to collect anonymous statistics, so we can understand how customers use our site and make improvements. Essential cookies cannot be deactivated, but you can choose “Customize” or “Decline” to decline performance cookies.

If you agree, AWS and approved third parties will also use cookies to provide useful site features, remember your preferences, and display relevant content, including relevant advertising. To accept or decline all non-essential cookies, choose “Accept” or “Decline.” To make more detailed choices, choose “Customize.”

Use CreateOpportunity with an AWS SDK - AWS SDK Code Examples

There are more AWS SDK examples available in the AWS Doc SDK Examples GitHub repo.

There are more AWS SDK examples available in the AWS Doc SDK Examples GitHub repo.

Use CreateOpportunity with an AWS SDK

The following code example shows how to use CreateOpportunity.

.NET
SDK for .NET

Create an opportunity.

// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // PDX-License-Identifier: Apache-2.0 using System; using Newtonsoft.Json; using Amazon; using Amazon.Runtime; using Amazon.PartnerCentralSelling; using Amazon.PartnerCentralSelling.Model; namespace AWSExample { class Program { static readonly string catalogToUse = "AWS"; static async Task Main(string[] args) { // Initialize credentials from .aws/credentials file var credentials = new Amazon.Runtime.CredentialManagement.SharedCredentialsFile(); if (credentials.TryGetProfile("default", out var profile)) { AWSCredentials awsCredentials = profile.GetAWSCredentials(credentials); var client = new AmazonPartnerCentralSellingClient(awsCredentials); var request = new CreateOpportunityRequest { Catalog = catalogToUse, Origin = "Partner Referral", Customer = new Customer { Account = new Account { Address = new Address { CountryCode = "US", PostalCode = "99502", StateOrRegion = "Alaska" }, CompanyName = "TestCompanyName", Duns = "123456789", WebsiteUrl = "www.test.io", Industry = "Automotive" }, Contacts = new List<Contact> { new Contact { Email = "test@test.io", FirstName = "John ", LastName = "Doe", Phone = "+14444444444", BusinessTitle = "test title" } } }, LifeCycle = new LifeCycle { ReviewStatus = "Submitted", TargetCloseDate = "2024-12-30" }, Marketing = new Marketing { Source = "None" }, OpportunityType = "Net New Business", PrimaryNeedsFromAws = new List<string> { "Co-Sell - Architectural Validation" }, Project = new Project { Title = "Moin Test UUID", CustomerBusinessProblem = "Sandbox is not working as expected", CustomerUseCase = "AI Machine Learning and Analytics", DeliveryModels = new List<string> { "SaaS or PaaS" }, ExpectedCustomerSpend = new List<ExpectedCustomerSpend> { new ExpectedCustomerSpend { Amount = "2000.0", CurrencyCode = "USD", Frequency = "Monthly", TargetCompany = "Ibexlabs" } }, SalesActivities = new List<string> { "Initialized discussions with customer" } } }; try { var response = await client.CreateOpportunityAsync(request); Console.WriteLine(response.HttpStatusCode); string formattedJson = JsonConvert.SerializeObject(response, Formatting.Indented); Console.WriteLine(formattedJson); } catch (ValidationException ex) { Console.WriteLine("Validation error: " + ex.Message); } catch (AmazonPartnerCentralSellingException e) { Console.WriteLine("Failed:"); Console.WriteLine(e.RequestId); Console.WriteLine(e.ErrorCode); Console.WriteLine(e.Message); } } else { Console.WriteLine("Profile not found."); } } } }
SDK for .NET

Create an opportunity.

// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // PDX-License-Identifier: Apache-2.0 using System; using Newtonsoft.Json; using Amazon; using Amazon.Runtime; using Amazon.PartnerCentralSelling; using Amazon.PartnerCentralSelling.Model; namespace AWSExample { class Program { static readonly string catalogToUse = "AWS"; static async Task Main(string[] args) { // Initialize credentials from .aws/credentials file var credentials = new Amazon.Runtime.CredentialManagement.SharedCredentialsFile(); if (credentials.TryGetProfile("default", out var profile)) { AWSCredentials awsCredentials = profile.GetAWSCredentials(credentials); var client = new AmazonPartnerCentralSellingClient(awsCredentials); var request = new CreateOpportunityRequest { Catalog = catalogToUse, Origin = "Partner Referral", Customer = new Customer { Account = new Account { Address = new Address { CountryCode = "US", PostalCode = "99502", StateOrRegion = "Alaska" }, CompanyName = "TestCompanyName", Duns = "123456789", WebsiteUrl = "www.test.io", Industry = "Automotive" }, Contacts = new List<Contact> { new Contact { Email = "test@test.io", FirstName = "John ", LastName = "Doe", Phone = "+14444444444", BusinessTitle = "test title" } } }, LifeCycle = new LifeCycle { ReviewStatus = "Submitted", TargetCloseDate = "2024-12-30" }, Marketing = new Marketing { Source = "None" }, OpportunityType = "Net New Business", PrimaryNeedsFromAws = new List<string> { "Co-Sell - Architectural Validation" }, Project = new Project { Title = "Moin Test UUID", CustomerBusinessProblem = "Sandbox is not working as expected", CustomerUseCase = "AI Machine Learning and Analytics", DeliveryModels = new List<string> { "SaaS or PaaS" }, ExpectedCustomerSpend = new List<ExpectedCustomerSpend> { new ExpectedCustomerSpend { Amount = "2000.0", CurrencyCode = "USD", Frequency = "Monthly", TargetCompany = "Ibexlabs" } }, SalesActivities = new List<string> { "Initialized discussions with customer" } } }; try { var response = await client.CreateOpportunityAsync(request); Console.WriteLine(response.HttpStatusCode); string formattedJson = JsonConvert.SerializeObject(response, Formatting.Indented); Console.WriteLine(formattedJson); } catch (ValidationException ex) { Console.WriteLine("Validation error: " + ex.Message); } catch (AmazonPartnerCentralSellingException e) { Console.WriteLine("Failed:"); Console.WriteLine(e.RequestId); Console.WriteLine(e.ErrorCode); Console.WriteLine(e.Message); } } else { Console.WriteLine("Profile not found."); } } } }
PrivacySite termsCookie preferences
© 2025, Amazon Web Services, Inc. or its affiliates. All rights reserved.