How can I pass the content of the media type "application/vnd.spCampaign.v3+json" from AmazonAdsAPI in C#?
I am currently trying to run ADSAPI sp/campaigns/list in post in HttpClient in C#.
You need to pass the content by media type "application/vnd.spCampaign.v3+json".
However, I do not know how to create content in this format.
Could you tell me how to pass content to this media type?
Make your first call to the Amazon Ads API
https://advertising.amazon.com/API/docs/en-us/getting-started/first-call#/sample-requests
I have solved myself.
Create a StringContent in json format as you did with media type
application/json.
Resolved by changing media type to application/vnd.spCampaign.v3+json
public static async Task<StringContent>GetContentFormJson(object data,Encoding encode=null,Encoding contentEncoding=null)
{
try
{
var json=data converted to json
if(json!=null)
{
var content = new StringContent(json, contentEncoding??) Encoding.UTF8, @"application/json";
content.Headers.ContentType=new MediaTypeHeaderValue("application/vnd.spCampaign.v3+json");
return content;
}
}
catch (Exception ex)
{
error log handling
}
return null;
}
© 2025 OneMinuteCode. All rights reserved.