Can't get my REST call to work

edited March 2, 2017 in Questions
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) :
image

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

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) :
image

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...)

Comments

  • Rob HatchRob Hatch 💎💎💎
    edited September 1, 2016
    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. 
  • edited March 2, 2017
    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.
  • edited March 29, 2016
    I'm also having issues, but my remote site setting is correct. The URL looks like it is correct, as it is rendering the JSON: 
    http://developer.itsmarta.com/RealtimeTrain/RestServiceNextTrain/GetRealtimeArrivals?apikey=8c49d528-5bdc-4b37-a2a8-ea553622a8db 

    What am I missing?? 
  • Rob HatchRob Hatch 💎💎💎
    edited September 1, 2016
    Where did you get that URL?  It works for me. 
  • edited March 30, 2016
    The URL works, but why doesn't the Service work in Skuid? It's not showing the fields when I try to set up the model. 
  • Emily DavisEmily Davis ✭✭✭✭
    edited December 21, 2016
    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
  • edited March 31, 2016
    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! 
  • Emily DavisEmily Davis ✭✭✭✭
    edited December 21, 2016
    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.

    image

    (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.

    image
  • edited March 31, 2016
    Perfect! Thanks for your help. 
  • edited April 19, 2016
    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?
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!