Can someone help me get the errors that can be sent by the REST api

I'm making a new SDK for particleio REST APIs in swift which is strongly typed.
I'd like to be able to get a list of all error values that can be sent by the server as some responses collide with each other. For example the some responses include an 'ok' bool and a 'message' String while an error may provide an 'ok' bool and an 'error' string. The decode strategy needs to know that it's an error and not a message. I hope that makes sense.. so far I am having to catch the error at the time the sdk type is created, but I would much rather handle it all in the error checking method itself. Thanks

There is no list of API endpoints sorted by return values. You just have to look through all of the API calls and note the ones that have different return values.

Also note:

  • Product endpoints sometimes have a different result shape from non-product endpoints for the same API. This is because the product results may be paginated and have a body array and meta object.
  • Beware of non-product API calls like listDevices that directly return an array on success.

Well thats a shame.. I was hoping there would be an enum or something I could piggy back off of. I think I'm around 15,000 lines of code in so I was really hoping for a clean easy solution. I guess I'll have to roll the sleeves up and just do the work. Thanks.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.