Create smart campaign via API

Ankit_Kumar3
Level 2

Create smart campaign via API

Hello Guys,

I want to create a smart campaign via API in Marketo. I am just trying to learn how Marketo APIs work.

 

Below are the endpoint and body I am using for this in POSTMAN, but it's giving me an error:

API-1.PNG

 

Below is the header and parameters:

API-2.PNGAPI-3.PNG

Please guide me on what I missing or doing wrong.

 

 

2 REPLIES 2
SanfordWhiteman
Level 10 - Community Moderator

Re: Create smart campaign via API

It would be a lot easier to read your payloads and headers if you posted them using the syntax highlighter — “Insert/Edit Code Sample — instead of as screenshots. (Perhaps with Postman screenshots as an accompaniment.)

 

Thus far I can see you’re sending the wrong Content-Type. This endpoint takes a form-urlencoded payload with embedded JSON type params, not a JSON payload.

 

You also don’t need to send the literal query param createSmartCampaignRequest. That’s a placeholder in the docs that represents the schema, and yes, it is confusing! There’s also an error in the docs, as spaces in the payload must be encoded:

name=Smart%20Campaign%2002&folder={"type":%20"folder","id":%20640}&description=This%20is%20a%20smart%20campaign%20creation%20test.

 

Finally, this isn’t a very good API endpoint to start learning Marketo with, since the APIs for manipulating flow steps, etc. aren’t finished.

Ankit_Kumar3
Level 2

Re: Create smart campaign via API

Thank you @SanfordWhiteman. for your feedback, just trying to figure out the best way to learn Marketo API and how I can use the given endpoints.

 As per the doc, the content type should be as below. in this case what to use for 'x'? 

 
Content-Type: application/x-www-form-urlencoded