HTTP 500 when retrieving a position via the API (started today)

Tagged:

Currently contains 11 posts

Avatar

July 20, 2021 15:45

Catherine

We use a custom built WordPress plugin to display current jobs that are active, ‘hot or not’ and set to show on web (via the API). The code hasn’t changed in a long time but starting today there are no results coming back with those parameters.

When I widen the query (I removed ‘ShowOnWeb eq 1’ from the query), I do receive results. However, when I click to retrieve a result the single retrieved position is throwing a 500 error where the stacktrace says “Requested value ‘US’ was not found”. I don’t know what that means as I’m not sending any parameter regarding country code or anything.

I saw there was a upgrade to PCR scheduled today and this coincidentally started today (no code has changed) so I’m wondering if something changed?

Stack Trace portion:
[http_response] => WP_HTTP_Requests_Response Object
(
[response:protected] => Requests_Response Object
(
[body] => {"Message":“An error has occurred.”,“ExceptionMessage”:“Requested value ‘US’ was not found.”,“ExceptionType”:“System.ArgumentException”,“StackTrace”:" at System.Enum.TryParseEnum(Type enumType, String value, Boolean ignoreCase, EnumResult& parseResult)\r\n at System.Enum.Parse(Type enumType, String value, Boolean ignoreCase)\r\n at DataHandlerExtension.Mappers.PositionMapper.MapFieldEnumToPosition(enumPositions field, Position& p, String value) in C:\\mst-agile-git\\Source\\WebServices\\REST\\DataHandlerExtension\\Mappers\\PositionMapper.cs:line 228\r\n at DataHandlerExtension.DAL.PositionDataHandler.GetById(Int64 id, List`1 fields, List`1 customFields, List`1 eeocFields) in C:\\mst-agile-git\\Source\\WebServices\\REST\\DataHandlerExtension\\DAL\\Deprecated\\PositionDataHandler.cs:line 182\r\n at PcrRestApi.Controllers.PositionsController.Get(Int64 JobId, PositionRequest getRequest) in C:\\mst-agile-git\\Source\\WebServices\\REST\\PcrRestApi\\Controllers\\Deprecated\\PositionsController.cs:line 43\r\n at lambda_method(Closure , Object , Object[] )\r\n at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayClass6_2.b__2(Object instance, Object[] methodParameters)\r\n at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ExecuteAsync(HttpControllerContext controllerContext, IDictionary`2 arguments, CancellationToken cancellationToken)\r\n—- End of stack trace from previous location where exception was thrown -\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Web.Http.Controllers.ApiControllerActionInvoker.d__1.MoveNext()\r\n—- End of stack trace from previous location where exception was thrown -\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Web.Http.Controllers.ActionFilterResult.d__5.MoveNext()\r\n—- End of stack trace from previous location where exception was thrown -\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Web.Http.Controllers.ExceptionFilterResult.d__6.MoveNext()\r\n—- End of stack trace from previous location where exception was thrown -\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Web.Http.Controllers.ExceptionFilterResult.d__6.MoveNext()\r\n—- End of stack trace from previous location where exception was thrown -\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Web.Http.Dispatcher.HttpControllerDispatcher.d__15.MoveNext()"}
[raw] => HTTP/1.1 500 Internal Server Error

Avatar

July 20, 2021 15:53

Jarrid-PCRecruiter

Try changing the show on web variable to 0 (true) or -1 (false)

&Query=ShowOnWeb eq 0

If you’re looking up currency, make sure you’re using USD instead of US.

Avatar

July 20, 2021 16:27

Catherine

Your recommendation of changing 1 to 0 did work to retrieve results. In terms of the US thing I still don’t know specifically where that’s coming from (nowhere do I ask for US or currency or anything).

However, I previously was not sending in any specific Fields in my query options. When I add an actual list of specific Fields for the position it no longer throws that error. Is there a way to retrieve ALL fields on the request? Obviously leaving it blank doesn’t seem to be working

Avatar

July 20, 2021 16:29

Jarrid-PCRecruiter

Is this for the WebApply user? If so, I went in and made the changes to currency that should have fixed that message.

You’d need to use FieldsPlus and list each field.

Avatar

July 20, 2021 16:40

Catherine

Yes, for the WebApply user.

Sorry, I’m not familiar with FieldsPlus; what is that? I’m using the endpoint positions/DistinctFields to retrieve a list. Specifically I’m looking to retrieve the Current ID value that the client sees on the screen. I see it listed as Current ID in the distinct fields list but having tried various iterations that might be an attribute of the response object, I’m not getting back anything.

Avatar

July 20, 2021 16:44

Jarrid-PCRecruiter

Check the documentation at https://www.pcrecruiter.net/apidocs_v2/

FieldsPlus is a parameter you can use to specify which additional fields to display in the results.

Avatar

July 20, 2021 16:57

Catherine

oh ok; I didn’t see that parameter; I’ve just been using “Fields”. I guess I’m unclear of the difference.

How do I retrieve a list of what the system is expecting to get there? In my specific example I’m working through, the PCR UI shows “Current Id” which is also what the DistinctFields endpoint returns but if I put that in the Fields (or FieldsPlus, or Custom I’ve tried all) I do not get a corresponding attribute back from on the response object.

SO I assumed the value being passed into any of those Fields parameters needed to be exactly what the attribute is called on the response object so I tried CurrentID, currentID, CurrentId, etc.. After all that, however, I still cannot retrieve Current ID in my response

Avatar

July 20, 2021 17:04

Catherine

Never mind; I think I figured it out; I added the exact case that came back from Distinct Fields into the Custom parameter and it does now have an array returned on the response object. Ok I think all is good. Thanks so much for your help and prompt responses!

Avatar

July 20, 2021 17:16

Jarrid-PCRecruiter

Sorry I didn’t realize that was a custom field, you do need to use:
&Custom=Current Id

If you only want records that have a Current ID value you could add this:
&Query=Current Id co %

Avatar

July 20, 2021 17:35

Catherine

Ok thanks! Also, are there ongoing issues? Suddenly I just only started receiving 3 results back from the query and I haven’t changed the ResultsPerPage or Page parameters.. It was all working, then I sent a screen shot to the client and she came back and said she was only receiving 3 results. Now I refresh and I only see 3 as well.

Avatar

July 20, 2021 20:06

Jarrid-PCRecruiter

Not that I’m aware of but I think our dev and QA teams may be pushing fixes as they become available.

Reply to thread