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;
}
572 Who developed the "avformat-59.dll" that comes with FFmpeg?
910 When building Fast API+Uvicorn environment with PyInstaller, console=False results in an error
616 Uncaught (inpromise) Error on Electron: An object could not be cloned
571 rails db:create error: Could not find mysql2-0.5.4 in any of the sources
609 GDB gets version error when attempting to debug with the Presense SDK (IDE)
© 2024 OneMinuteCode. All rights reserved.