Can't get my REST call to work

  • 1
  • Problem
  • Updated 3 years ago
  • Solved
  • (Edited)
Hey guys,

I've been trying to find a solution for some time but still no luck.. Here's my issue : I'm trying to have my new Model based on a REST GET method to Atlassian's Jira API but can't get it to work. (It works well with BitBucket API)

I set up the new Model Service, Remote Site Settings in Salesforce as well (see below) :


I even checked that this request works with another tool, everything is good with the API and the URL I use (see below) :


But I'm getting the error "1. Error retrieving metadata for Model(s) associated with Data Source 'JIRA'. Please check Models' properties to ensure they are set correctly. Error connecting to REST Data Source at URL "https://xxxx.atlassian.net/rest/api/2/search": error" (see below) :


There might be something I'm doing wrong.. Help would be much appreciated!

Also, I would like to be able to POST json in order to get more specific answers, is that possible with skuid models? (I tried to select POST method and paste my json in the Service URL field but it just appends it to my base request URL...)
Photo of Celio Nelson

Celio Nelson

  • 100 Points 100 badge 2x thumb
  • frustrated

Posted 3 years ago

  • 1
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,006 Points 20k badge 2x thumb
I think you are missing a "/" between the words API2 and Search.   The first part is being passed from you Model service,  and the second part is being passed from the Service URL property of the model.  Taken together they form a full REST Url call.  

One way to debug what is actually happening is to use the browsers dev tools "network" function and explore the ApexRemote calls that are actually sent when you try to execute the model.  (More information about that is here:  http://help.skuidify.com/m/models-conditions-filters/l/455021-troubleshooting-and-debugging-for-exte...  )

As for your second question.  It really depends on what the JIRA APi will allow.  If it will take JSON in the URL string and use that to filter results than you can probably pass it.  Just make sure you are URL encoding the JSON.  (See this post on URL Encode function:  http://help.skuidify.com/m/11720/l/187263-global-merge-variables-functions  ). 

Hope that helps. 
Photo of Celio Nelson

Celio Nelson

  • 100 Points 100 badge 2x thumb
Finally got it to work.

The issue was that, when I had created the Model Service, skuid did not prompt me to create a new Remote Site Setting in Salesforce (apparently it's not doing it when you uncheck the checkbox "Use Apex Proxy"). Therefore I created it manually but it was still not working.

What worked was deleting the existing Model Service and recreating it with the checkbox "Use Apex Proxy" checked this time. Then I was prompted to add a Remote Site Setting, I clicked OK.

Now it's working well. Thanks for your help, Rob.
Photo of Emily Davis

Emily Davis, Employee

  • 3,502 Points 3k badge 2x thumb
Mark,
What are you using for the Model Service URL (in the Model Services list)? What about your Service URL for the model in the page?
Emily
Photo of Mark Kovacevich

Mark Kovacevich

  • 100 Points 100 badge 2x thumb
Well, I figured it out. The REST Call had to be segmented between the Model Service and the Model. 
The Model Service has this piece: (which matches with the Remote Site Settings in the Org):  http://developer.itsmarta.com
The Model itself has this piece: /RealtimeTrain/RestServiceNextTrain/GetRealtimeArrivals?apikey=8c49d528-5bdc-4b37-a2a8-ea553622a8db

Once I did that, the fields were visible, and I am on my way. 

That being said, is there a way to delete a page? I have one where the Model is wrong and it won't load so I can edit it. Thanks! 
Photo of Emily Davis

Emily Davis, Employee

  • 3,502 Points 3k badge 2x thumb
Glad you figured it out, Mark! Shoot, sorry about the issue you're experiencing now. I would go to the Pages list in Skuid, and either:
(a) Click the "Versions" row action so you can roll back a version and view the page.



(b) To delete, select the page that is broken from the Pages list, and use the "Flag Selected Rows for Deletion" mass action to delete it.

Photo of Mark Kovacevich

Mark Kovacevich

  • 100 Points 100 badge 2x thumb
Perfect! Thanks for your help. 
Photo of Mark Kovacevich

Mark Kovacevich

  • 100 Points 100 badge 2x thumb
Well, the data comes in and populates a Table, but I can't add Conditions so I can sort and filter the data. Any ideas?