REST Apex Proxy not connecting to model

I have a REST service I’m trying to hook up from an external platform. It is setup using a Separate Authentication URL and Apex Proxy. I can verify that the payload is returned with the expected data when the model is queried via inspecting the network and the structure looks the same as other REST services I have setup. However, the payload is not passed to the model. This feels like a bug, but was wondering if there’s a setup step missing.

The payload looks fine with Postman. Here’s a screenshot of the beginning of the return:

I should also add that the model setup works like I’d expect with being able to add fields and such.

Can you post the Model XML, and some more details about the structure of the data coming back? Need more details than what was provided in the screenshot in order to assess.

Zach - Thanks for the follow-up. Here’s the XML for the page and the response payload that I snagged from the Network console. Note that I’ve scrubbed some of the text strings in the body to take any sensitive data out.

{{RequiredResponseDate}}{{PositionQuantity}}

[{“statusCode”:200,“type”:“rpc”,“tid”:4,“ref”:false,“action”:“skuid.RemotingStubs”,“method”:“proxy”,“result”:“{"statusCode":200,"status":"OK","setCookies":,"headers":{"Content-Type":"text/plain;charset=UTF-8","Public-Key-Pins":"pin-sha256=\"xxx=\"; pin-sha256=\"xxx=\"; max-age=5184000; includeSubdomains","X-XSS-Protection":"1; mode=block","Content-Length":"11000","Expires":"-1","Content-Security-Policy":"","Cache-Control":"no-store,no-cache,must-revalidate","Strict-Transport-Security":"max-age=31536000 ; includeSubDomains","X-Frame-Options":"SAMEORIGIN","Access-Control-Allow-Headers":"X-ACCESS_TOKEN, Access-Control-Allow-Origin, Authorization, X-ApplicationKey, Origin, x-requested-with, Content-Type, Content-Range, Content-Disposition, Content-Description, X-Mobile-Client-Version","Date":"Mon, 06 Nov 2017 22:58:29 GMT","Pragma":"no-cache","X-Permitted-Cross-Domain-Policies":"none","X-Content-Type-Options":"nosniff","Access-Control-Allow-Methods":"POST, GET, OPTIONS, PUT","Access-Control-Allow-Origin":"*","Server":"InSite"},"error":null,"body":"{\n\t\"StaffingOrder\" : {\n\t\t\"@xmlns\" : \"jobPosting\",\n\t\t\"@xmlns:xsi\" : \"http://www.w3.org/2001/XMLSchema-instance\",\n\t\t\"@xsi:schemaLocation\"; : \"jobPosting https://www.fieldglass.net/schema/InSiteJobPostingV2.xsd\",\n\t\t\"OrderId\"; : {\n\t\t\t\"@validFrom\" : \"2017-07-09\",\n\t\t\t\"@validTo\" : \"2017-10-09\",\n\t\t\t\"IdValue\" : \"xxx\",\n\t\t\t\"Status\" : \"Closed\"\n\t\t},\n\t\t\"ReferenceInformation\" : {\n\t\t\t\"StaffingSupplierId\" : {\n\t\t\t\t\"IdValue\" : \"xxx\"\n\t\t\t},\n\t\t\t\"StaffingCustomerId\" : {\n\t\t\t\t\"IdValue\" : \"xxx\"\n\t\t\t},\n\t\t\t\"NamedJobPosting\" : \"yes\"\n\t\t},\n\t\t\"BusinessUnit\" : \"M-A\",\n\t\t\"ClosedReasonName\" : \"label.system.reason.FGLS_AUTO_CLOSE_ON_FILL\",\n\t\t\"OrderClassification\" : {\n\t\t\t\"@orderType\" : \"Strategic\",\n\t\t\t\"@orderStatus\" : \"new\"\n\t\t},\n\t\t\"Comments\" : {\n\t\t\t\"Comment\" : null,\n\t\t\t\"CreatorName\" : null,\n\t\t\t\"CreateTime\" : null\n\t\t},\n\t\t\"OrderContact\" : {\n\t\t\t\"@contactType\" : \"placedBy\",\n\t\t\t\"ContactInfo\" : {\n\t\t\t\t\"PersonName\" : {\n\t\t\t\t\t\"LegalName\" : \"F\",\n\t\t\t\t\t\"FormattedName\" : \"noone\"\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\t\"OrderCreatedFor\" : {\n\t\t\t\"WorkforceID\" : \"x11111\",\n\t\t\t\"WorkforceName\" : \"no, one\"\n\t\t},\n\t\t\"RequiredResponseDate\" : \"2017-07-09\",\n\t\t\"PositionQuantity\" : \"1\",\n\t\t\"MaxSubmissionsAllowed\" : \"1\",\n\t\t\"CanSubmitJobSeeker\" : \"no\",\n\t\t\"StaffingPosition\" : {\n\t\t\t\"PositionHeader\" : {\n\t\t\t\t\"PositionTitle\" : \"Strategic\",\n\t\t\t\t\"FormattedPositionDescription\" : {\n\t\t\t\t\t\"Value\" : \"Some database query experience with SQL is a plus Preferred Qualifications � BA/BS degree in Communication, Psychology, Statistics or Economics is preferred � Academic excellence in relevant coursework � Superior analytical skills � Excellent communication skills, both verbal & written � Experience working in Media or Psychology labs Experience � Requires 0-18 months of related experience Education � Associate�s or Bachelor�s degree preferred\"\n\t\t\t\t}\n\t\t\t},\n\t\t\t\"PrimaryDepartment\" : \"\",\n\t\t\t\"Departments\" : {\n\t\t\t\t\"Department\" : {\n\t\t\t\t\t\"Code\" : \"979\",\n\t\t\t\t\t\"Name\" : \"979\",\n\t\t\t\t\t\"Allocation\" : \"100.000\"\n\t\t\t\t}\n\t\t\t},\n\t\t\t\"PositionDateRange\" : {\n\t\t\t\t\"StartDate\" : \"2017-07-09\",\n\t\t\t\t\"ExpectedEndDate\" : \"2017-10-09\",\n\t\t\t\t\"CreateDate\" : \"2017-09-05\",\n\t\t\t\t\"SubmitDate\" : \"2017-09-05\",\n\t\t\t\t\"ClosedDate\" : \"2017-10-09\"\n\t\t\t},\n\t\t\t\"ServiceType\" : \"Temp\",\n\t\t\t\"JobType\" : \"Full Time\",\n\t\t\t\"ReportToPerson\" : {\n\t\t\t\t\"ContactInfo\" : {\n\t\t\t\t\t\"PersonName\" : {\n\t\t\t\t\t\t\"LegalName\" : \"6\",\n\t\t\t\t\t\t\"FormattedName\" : \"no, one\"\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t},\n\t\t\t\"Coordinator\" : {\n\t\t\t\t\"ContactInfo\" : {\n\t\t\t\t\t\"PersonName\" : {\n\t\t\t\t\t\t\"LegalName\" : \"O\",\n\t\t\t\t\t\t\"FormattedName\" : \"Office\"\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t},\n\t\t\t\"Distributor\" : {\n\t\t\t\t\"ContactInfo\" : {\n\t\t\t\t\t\"PersonName\" : {\n\t\t\t\t\t\t\"LegalName\" : \"gri\",\n\t\t\t\t\t\t\"FormattedName\" : \"Office\"\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t},\n\t\t\t\"WorkSite\" : {\n\t\t\t\t\"WorkSiteId\" : {\n\t\t\t\t\t\"Id\" : \"73\"\n\t\t\t\t},\n\t\t\t\t\"Address\" : \"1 None Drive\",\n\t\t\t\t\"Address2\" : null,\n\t\t\t\t\"City\" : \"Irving\",\n\t\t\t\t\"StateCode\" : \"TX\",\n\t\t\t\t\"PostalCode\" : \"75039\"\n\t\t\t},\n\t\t\t\"Rates\" : [ {\n\t\t\t\t\"@rateType\" : \"bill\",\n\t\t\t\t\"@rateStatus\" : \"agreed\",\n\t\t\t\t\"@payType\" : \"Default\",\n\t\t\t\t\"BillAmount\" : {\n\t\t\t\t\t\"@rateAmountPeriod\" : \"Hr\",\n\t\t\t\t\t\"@currency\" : \"USD\",\n\t\t\t\t\t\"$\" : \"150.01\"\n\t\t\t\t},\n\t\t\t\t\"PayAmount\" : {\n\t\t\t\t\t\"@rateAmountPeriod\" : \"Hr\",\n\t\t\t\t\t\"@currency\" : \"USD\",\n\t\t\t\t\t\"$\" : \"0.00\"\n\t\t\t\t},\n\t\t\t\t\"Class\" : \"ST\",\n\t\t\t\t\"Markup\" : null,\n\t\t\t\t\"Factor\" : null,\n\t\t\t\t\"BaseClass\" : null\n\t\t\t}, {\n\t\t\t\t\"@rateType\" : \"bill\",\n\t\t\t\t\"@rateStatus\" : \"agreed\",\n\t\t\t\t\"@payType\" : \"Default\",\n\t\t\t\t\"BillAmount\" : {\n\t\t\t\t\t\"@rateAmountPeriod\" : \"Hr\",\n\t\t\t\t\t\"@currency\" : \"USD\",\n\t\t\t\t\t\"$\" : \"225.01\"\n\t\t\t\t},\n\t\t\t\t\"PayAmount\" : {\n\t\t\t\t\t\"@rateAmountPeriod\" : \"Hr\",\n\t\t\t\t\t\"@currency\" : \"USD\",\n\t\t\t\t\t\"$\" : \"0.00\"\n\t\t\t\t},\n\t\t\t\t\"Class\" : \"OT\",\n\t\t\t\t\"Markup\" : null,\n\t\t\t\t\"Factor\" : \"1.500\",\n\t\t\t\t\"BaseClass\" : \"ST\"\n\t\t\t}, {\n\t\t\t\t\"@rateType\" : \"bill\",\n\t\t\t\t\"@rateStatus\" : \"agreed\",\n\t\t\t\t\"@payType\" : \"Default\",\n\t\t\t\t\"BillAmount\" : {\n\t\t\t\t\t\"@rateAmountPeriod\" : \"Hr\",\n\t\t\t\t\t\"@currency\" : \"USD\",\n\t\t\t\t\t\"$\" : \"300.01\"\n\t\t\t\t},\n\t\t\t\t\"PayAmount\" : {\n\t\t\t\t\t\"@rateAmountPeriod\" : \"Hr\",\n\t\t\t\t\t\"@currency\" : \"USD\",\n\t\t\t\t\t\"$\" : \"0.00\"\n\t\t\t\t},\n\t\t\t\t\"Class\" : \"DT\",\n\t\t\t\t\"Markup\" : null,\n\t\t\t\t\"Factor\" : \"2.000\",\n\t\t\t\t\"BaseClass\" : \"ST\"\n\t\t\t} ],\n\t\t\t\"CustomFields\" : {\n\t\t\t\t\"CustomField\" : [ {\n\t\t\t\t\t\"@name\" : \"Standard Background Check Items\",\n\t\t\t\t\t\"@mandatory\" : \"yes\",\n\t\t\t\t\t\"@type\" : \"xsd:string\",\n\t\t\t\t\t\"Value\" : \"Criminal Background Check, All Counties, States and Federal Districts of Residences during prior 10 years, Past Employment Verification – prior 10 years, Education/ Professional Licensing Verification, Social Security Verification, Sex Offender Registry Check (where allowed by state law)\",\n\t\t\t\t\t\"Class\" : \"JobPosting\"\n\t\t\t\t}, {\n\t\t\t\t\t\"@name\" : \"Additional Background Check Requirements\",\n\t\t\t\t\t\"@mandatory\" : \"no\",\n\t\t\t\t\t\"@type\" : \"xsd:string\",\n\t\t\t\t\t\"Value\" : null,\n\t\t\t\t\t\"Class\" : \"JobPosting\"\n\t\t\t\t}, {\n\t\t\t\t\t\"@name\" : \"Worker Type\",\n\t\t\t\t\t\"@mandatory\" : \"yes\",\n\t\t\t\t\t\"@type\" : \"xsd:pickList\",\n\t\t\t\t\t\"pickList\" : {\n\t\t\t\t\t\t\"@isCompleteList\" : \"yes\",\n\t\t\t\t\t\t\"@totalNumberOfItems\" : \"4\",\n\t\t\t\t\t\t\"item\" : [ \"ICW\", \"PSW\", \"TIW\", \"TSW\" ]\n\t\t\t\t\t},\n\t\t\t\t\t\"Value\" : null,\n\t\t\t\t\t\"Class\" : \"JobSeeker\"\n\t\t\t\t}, {\n\t\t\t\t\t\"@name\" : \"If \\\"yes\\\" to #1 above, the supplier needs to provide end date of employment\",\n\t\t\t\t\t\"@mandatory\" : \"no\",\n\t\t\t\t\t\"@type\" : \"xsd:date\",\n\t\t\t\t\t\"Value\" : null,\n\t\t\t\t\t\"Class\" : \"JobSeeker\"\n\t\t\t\t}, {\n\t\t\t\t\t\"@name\" : \"Is the Job Seeker a Former Alliance Data Employee?\",\n\t\t\t\t\t\"@mandatory\" : \"yes\",\n\t\t\t\t\t\"@type\" : \"xsd:pickList\",\n\t\t\t\t\t\"pickList\" : {\n\t\t\t\t\t\t\"@isCompleteList\" : \"yes\",\n\t\t\t\t\t\t\"@totalNumberOfItems\" : \"2\",\n\t\t\t\t\t\t\"item\" : [ \"No\", \"Yes\" ]\n\t\t\t\t\t},\n\t\t\t\t\t\"Value\" : null,\n\t\t\t\t\t\"Class\" : \"JobSeeker\"\n\t\t\t\t}, {\n\t\t\t\t\t\"@name\" : \"If \\\"yes\\\" to #1 above, the supplier needs to provide the Employee ID\",\n\t\t\t\t\t\"@mandatory\" : \"no\",\n\t\t\t\t\t\"@type\" : \"xsd:string\",\n\t\t\t\t\t\"Value\" : null,\n\t\t\t\t\t\"Class\" : \"JobSeeker\"\n\t\t\t\t} ]\n\t\t\t},\n\t\t\t\"Quals\" : null,\n\t\t\t\"PositionRules\" : {\n\t\t\t\t\"AutoEngage\" : \"no\",\n\t\t\t\t\"AutoRegister\" : \"no\",\n\t\t\t\t\"AutoActivate\" : \"no\",\n\t\t\t\t\"PayRateRequired\" : \"yes\",\n\t\t\t\t\"ResumeRequired\" : \"yes\",\n\t\t\t\t\"JobSeekerBillRateCanExceedRequestedBillRate\" : \"yes\",\n\t\t\t\t\"SupplierMustEnterRateChangeAmountsAndDurationOnJobSeekers\" : \"no\",\n\t\t\t\t\"AllowSupplierToSelectJobSeekerSite\" : \"no\"\n\t\t\t},\n\t\t\t\"InvoiceInfo\" : {\n\t\t\t\t\"AutoInvoiceType\" : \"Both\",\n\t\t\t\t\"TrialEndDate\" : null,\n\t\t\t\t\"TravelTime\" : \"0.000\",\n\t\t\t\t\"HoursPerDay\" : \"8.00\",\n\t\t\t\t\"HoursPerWeek\" : \"40.00\",\n\t\t\t\t\"BillablePerDiem\" : \"0.00\",\n\t\t\t\t\"EstimatedAdditionalSpend\" : \"81359.52\",\n\t\t\t\t\"EstimatedTotalHours\" : \"528.0\",\n\t\t\t\t\"EstimatedExpenses\" : \"0.000\",\n\t\t\t\t\"SiteTax\" : \"0.000\",\n\t\t\t\t\"MaximumExpenses\" : \"0.00\",\n\t\t\t\t\"ExternalReqNumber\" : null,\n\t\t\t\t\"PurchaseOrderNumber\" : null\n\t\t\t},\n\t\t\t\"SecurityIdInstruction\" : \"Please enter the Security ID as the candidate’s two digit birth month followed by birth day, and the last six digits of the Social Security Number. For example MMDDSSSSSS.\",\n\t\t\t\"SecurityIdPattern\" : \"[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]\"\n\t\t}\n\t}\n}"}”}]

Any further thoughts on this?

It looks like your service is returning data with a plain text content type — not JSON. Skuid REST Models requires that data be returned from the service as JSON. You will have to check with the particular REST API that you are connecting to, but you may be able to request that the data be returned as JSON by adding this Common Request Header to your Data Source: “Accept”: “application/json”

Also, when you say that “you are able to add fields to the Model in the page composer”, are you manually adding fields, or do the fields appear automatically for selection when you click on “Fields”?

I’ll check with the service provider to see if there’s an encoding issue on their end as I’m already requesting the response in json. What’s strange is that the fields appear automatically in the page composer.

Do you have any URL Merge Conditions on your Model? What’s the request URL look like? 

I don’t have any merge conditions setup yet. I’m using a specific record request to get the page up and running, then I can add a merge to make it dynamic. The URL for the endpoint is ‘https://www.fieldglass.net/api/vc/connector/supplier_job_posting_download/?object_ref=xxxJP00000487’.

I have other endpoints setup and they are working fine. Here’s a working API Response:

Here’s the response from the one that’s not populating the model, which looks pretty similar to me:

Also, Postman processes the response as expected:

So I did a bit more digging and got this figured out. It turns out that the response is getting parsed and the data is provided to the model, however the content was being wrapped in the “StaffingOrder” node. The XML had to be edited to add that as the path to the contents. For some reason the page composer was jumping over that.

Nice find! Were you not able to specify “Path to Contents” via the Page Composer? That should be possible without going into the XML.

I think there’s a bug somewhere in all this.  In the page composer, selecting “Path to Contents” shows the second level nodes (Comments, OrderClassification, OrderContact, etc.), but the parent level StaffingOrder isn’t found.  Leaving it blank allows me to navigate and add fields to the model, however these don’t populate when the model is queried. 

Adding the top level reference in the XML corrects the issue of the fields not populating, however it disables access to selecting fields in the model definition.  I can get around this by switching between the page composer and the XML, but it’s not the best situation.  I’m wondering if SKUID implicitly assumes that since there is only one node at the top of the response that the data path is in the child structure.

I figured this out using the skuid.model api and discovered the fields needed to be prepended with the “StaffingOrder” reference:

skuid.model.getModel(‘NewModel’).getFieldValue(skuid.model.getModel(‘NewModel’).getFirstRow(),‘StaffingOrder.@xmlns’)

John, what version of Skuid are you running?

This sounds like a bug that we fixed a while ago — in the Brooklyn Q2 release (10.x) I believe.

We’re on 10.0.5.  I’m evaluating Millau in a sandbox and will probably push that up once the next minor release comes out.  We just refreshed our main sandbox today, so it’ll be easy to test out the API issue.

That was it.  Works like a champ in 11.0.1.  I assume that you’re referring to the fix in 10.0.6 (CORE-543).

Just curious, what was the root cause on that bug.  We have other REST models that work fine on 10.0.6.