Skip to main content
Announcements
A fresh, new look for the Data Integration & Quality forums and navigation! Read more about what's changed.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Need help in calling a API in Marketo

I have tried several options to call for the API (details in the API, in URL mentioned below), through Talend.

I am able to call the API from Google/ARC, but is not able to do so from Talend. Would need some guidance on that.  ( http://developers.marketo.com/rest-api/bulk-import/bulk-lead-import/ )

I have tried these options:

i) Read a csv (through tFileInputDelimited) and converted that data to json and call the API via tRestClient component. I keep getting error "Invalid Content Type"

ii) I have also tried just calling the API using tFileInputDelimited(CSV option) and tRestClient giving all the required header parameter.This also gives the same error.

The API request is /bulk/v1/leads.json.Looking at the API call, it looks like it needs json input (as the URL suggest).From documentation, I understand that the API  needs CSV file with content type as multipart-form-data (as part of Header parameter). How do I achieve this in Talend.

Please let me know if you need more details or clarification to guide me.

Labels (5)
15 Replies
Anonymous
Not applicable
Author

Can you post a screenshot of what you have tried? This will give us an idea of what to suggest. My initial thoughts are that you have not set the HTTP method to "POST" and Content-Type to "FORM". I *think* the Accept-Type should be "Multipart" as well. However, it is much easier to try these things out quickly than to list suspected issues.

Anonymous
Not applicable
Author

Thank you for the response. I have set the HTTP method as POST, Content-Type as Form and Accept Type as Any. Attaching the screenshot of the tRestClient Basic and Advanced setting.

Please let me know if there is clarification needed.

Thank you.


Talendimage1.png
Anonymous
Not applicable
Author

Thank you for the response. I have set the HTTP method as POST, Content-Type as Form and Accept Type as Any. Attaching the screenshot of the tRestClient Basic and Advanced setting.

Please let me know if there is clarification needed.

Thank you.


Talendimage1.png
Talendimage1.png
Anonymous
Not applicable
Author

First I'd recommend changing the Accept Type to Multipart and try that out....although I'm doubtful that will make the difference. Next....unfortunately I could not make out anything from the images as the resolution is too poor

Anonymous
Not applicable
Author

Thank you for your response.

There is no 'multipart' as the Accept type or Content Type. And since the data needs to go to Marketo in multipart, I thought that the Accept type as Any should be ok.

I am attaching the pictures with better resolution.

 


TC_02062018.docx
Anonymous
Not applicable
Author

Sorry, I was using 6.5 when I looked at this. I take it you are not using that version. Leave that as it is. Try changing your header in the Advanced Settings to "Content-Type". I don't believe that case should matter, but I have seen it make a difference in the past. At the moment, your content-type selected by the drop down corresponds to "application/x-www-form-urlencoded".

Anonymous
Not applicable
Author

Yes, my version is 6.2.1.

Are you saying to change the "content-type" to "Content-Type".

I did that in the URL (in Basic setting and in Advance setting - changed the "content-type" to "Content-Type" and value is set to "multipart/form-data" ) of tRestClient and left the other settings as in the attachment and getting the error: "Invalid multipart request".

Thanks so much, hope we will be able to resolve this soon.

Anonymous
Not applicable
Author

Well that seems to show a step forward from before. So now we look at the next issue. I have just looked again at your requirement and it looks like you need to send an actual file...not just some JSON. Is that correct? If so, you may wish to change your component to a tFileFetch. Tick "Add Header" and set your content-type like before. Ensure that "POST method" is ticked. Set the URI as before. Go to Advanced Settings and select Upload File. Configure the file that you want to send in the table that appears there. This may need some trial and error.

Anonymous
Not applicable
Author

Hello:

 I had tried this option before as per some website suggestions and was stuck with an error.So now when I tried, I got the error back. 

C:\defaultfilename.txt (Access is denied).

Where is this setup coming from and how can i can change where the file gets written as I don't have permission to write a file under c:\.

Thanks.