Re: API Log Location

Anonymous
Not applicable

API Log Location

I am currently working on a Ruby on Rails integration and am getting a "System Error" response.  That is all the detail I have on it and would love to know if there is somewhere I can see the logs for the API calls.

Tags (4)
15 REPLIES 15
John_Clark1
Level 10

Re: API Log Location

Hi Jason,

There isn't currently a log in Marketo.

What call is it you're trying to work with?  Also, are you able to make a very basic authentication call?

John

Anonymous
Not applicable

Re: API Log Location

I am authenticating fine, I am retrieving a folder by name and I am trying to create and email template.

I am using a forked copy of this gem (raszi/mrkt · GitHub ) with the additional code I have added for reading the folder object (Get Folder by Name » Marketo Developers ) and creating the email template (Create Email Template » Marketo Developers ).

I have confirmed the inputs to be what I assume to be accurate, and the request is multipart, but the exception I am getting back is #<Mrkt::Errors::System: System error> which is outline in the documents as "Any other unhandled exception", which obviously does me no good to sort out the issue.

I have a API user created with Read/Write Assets enabled, and am starting to think I may need more?

John_Clark1
Level 10

Re: API Log Location

Hmmm, this is above my head.  Kenny Elkington​, any thoughts here?

John

Anonymous
Not applicable

Re: API Log Location

Now keep in mind, this is all fresh and new code.

I am not saying that it is accurate, but I can't trouble shoot when I can't see what the issues could possibly be.  I have it to a point where I am 80% certain this is working right on the code base side through this gem with the additional libraries I have added for the additional calls I need.

Output Example:

, [2015-09-29T14:12:27.962956 #24546]  INFO -- : get https://685-ZUA-702.mktorest.com/identity/oauth/token?client_id=XXXXXXXXXXXXXXXXXXXXXXXXXXXX&client_...

D, [2015-09-29T14:12:27.963193 #24546] DEBUG -- request: User-Agent: "Faraday v0.9.1"

I, [2015-09-29T14:12:29.913376 #24546]  INFO -- Status: 200

D, [2015-09-29T14:12:29.913598 #24546] DEBUG -- response: server: "nginx"

date: "Tue, 29 Sep 2015 18:12:29 GMT"

content-type: "application/json;charset=UTF-8"

transfer-encoding: "chunked"

connection: "close"

cache-control: "no-store"

pragma: "no-cache"

set-cookie: "BIGipServersjgcp-restapi_https=4262002698.47873.0000; path=/"

I, [2015-09-29T14:12:29.914306 #24546]  INFO -- : get https://685-ZUA-702.mktorest.com/rest/asset/v1/folder/byName.json?name=Software+Reviews

D, [2015-09-29T14:12:29.914442 #24546] DEBUG -- request: User-Agent: "Faraday v0.9.1"

Authorization: "Bearer 48ee073a-9bc5-4b14-85bf-f402bbd55107:sj"

I, [2015-09-29T14:12:30.311863 #24546]  INFO -- Status: 200

D, [2015-09-29T14:12:30.312026 #24546] DEBUG -- response: server: "nginx"

date: "Tue, 29 Sep 2015 18:12:30 GMT"

content-type: "application/json;charset=UTF-8"

transfer-encoding: "chunked"

connection: "close"

set-cookie: "BIGipServersjgcp-restapi_https=4262002698.47873.0000; path=/"

I, [2015-09-29T14:12:30.312689 #24546]  INFO -- : post https://685-ZUA-702.mktorest.com/rest/asset/v1/emailTemplates.json

D, [2015-09-29T14:12:30.312789 #24546] DEBUG -- request: User-Agent: "Faraday v0.9.1"

Authorization: "Bearer 48ee073a-9bc5-4b14-85bf-f402bbd55107:sj"

Accept: "application/json"

Content-Type: "multipart/form-data"

/Users/jbrodie/projects/mrkt/lib/mrkt/faraday_middleware/response.rb:25:in `handle_errors!': System error (Mrkt::Errors::System)

SanfordWhiteman
Level 10 - Community Moderator

Re: API Log Location

Can you post a sample multipart/form-data payload somewhere else (like Pastebin) so we can look at it?  This forum isn't good for sharing code.

Anonymous
Not applicable

Re: API Log Location

Sure can, can you clarify a could things for me?

In the API call for the new email template, it is looking for contents, I am assuming this is an actual file pointer based on your example code in the article?  But if this is the case, it blows up on a stack level too deep SystemStackError.  I have been sending in string content which is where the System Error is coming back from.

This is the payload when I am sending in the pile pointer: {:name=>"new templat - Pastebin.com

Kenny_Elkington
Marketo Employee

Re: API Log Location

Yes your 'content' param should be the content of the file.  It looks like this is happening at the Ruby level, and that's not really my area of expertise.  You may want to take this over to Stack Overflow for some code-specific help.

Anonymous
Not applicable

Re: API Log Location

Content of the file as in plain text input, regardless of valid html?

If that is the case then your example script posted on the article would never work.

  1. params = {
  2.   :name => "new template - Ruby", #name of new template
  3.   :folder => JSON.generate({:id => 15, :type => "Folder"}), #folder record as json
  4.   :content => File.new("testFile.html"), #HTML content of template
  5.   :description => "Email Template created by Ruby" #optional description
  6. }

as line 4 for content would actually return a file pointer, not the content.  For the content you would need to have File.new("somefile.html").read

Kenny_Elkington
Marketo Employee

Re: API Log Location

RestClient has magic to read files for Multiparts.