awork-io / awork

The awork Github repo supports you with awork integration and api questions. Here you can find links to further documentation, a FAQ with the most frequently asked questions and great code examples to get started even faster.
https://www.awork.com
11 stars 0 forks source link

aWork API - Post Absences field "externalProvider" causes error #132

Closed SebastianIngress closed 1 year ago

SebastianIngress commented 1 year ago

What happened?

Dear Sir or Madam,

we have managed to send posts for the absences "absences" via the API; only we are confused that if you put anything for "externalProvider" we get this error: file_get_contents(https://api.awork.io/api/v1/absences): failed to open stream: HTTP request failed! HTTP/1.1 401 Unauthorized

This is the POST body template in your docs: { "userId": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "startOn": "2023-07-28T13:55:28.909Z", "endOn": "2023-07-28T13:55:28.909Z", "description": "string", "externalProvider": "string", "isHalfDayOnStart": true, "isHalfDayOnEnd": true }

Is this a reserved field, but then why is it possible to set this at all?

With kind regards

Sebastian Sierocki

What is the trace id of the call?

We have our own httpRequest.class and send this:

HttpRequest Object ( [ContentType] => Content-Type: application/json [User] => [TimeOut] => 360 [Password] => [Content:HttpRequest:private] => {"userID":"f6f9cee9-c634-ed11-ae83-38563d6848fe","startOn":"2023-08-07T00:00:00.000Z","endOn":"2023-08-08T23:59:59.000Z","externalProvider":"wqe","description":"","isHalfDayOnStart":true,"isHalfDayOnEnd":true} [Headers:HttpRequest:private] => Array ( [0] => Authorization: Bearer ... "our token" [1] => Content-Type: application/json )

[Method:HttpRequest:private] => POST
[error:HttpRequest:private] => file_get_contents(https://api.awork.io/api/v1/absences): failed to open stream: HTTP request failed! HTTP/1.1 401 Unauthorized

)

Relevant error responses

No response

nilzzzzzz commented 1 year ago

Hi @SebastianIngress ,

we are using this field to mark absences which are created by internal integrations. So for example for our personio integration. We do not allow external API clients to set this field.

Our internal clients need to set this field, but we should make it more clear that it can not be set by external clients.

Best

Nils