createResource and updateResource should return json data by default, but allow raw response option

Created on 2 February 2024, 11 months ago
Updated 2 March 2024, 10 months ago

Problem/Motivation

Testing https://www.drupal.org/project/api_client/issues/3418815 I noticed something that in my opinion was lost in translation in the initial implementation.

createResource and updateResource were both updated to return data from the response rather than a boolean, but technically they return the raw response rather than the data from the response. I think we should change this so it is more consistent with our other methods - return the data by default, but provide an option to provide the raw response { response, json } as well.

Steps to reproduce

Make a valid call to createResource and updateResource and confirm the the return value is a Response object rather than json data.

Proposed resolution

* Change createResource and updateResource to return json data by default.
* Update createResource and updateResource to accept an options object that includes a 'rawResponse' option. If this is provided, the response will include the raw Response, along with the json data (similar to what our get based methods do)

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Fixed

Component

Code

Created by

🇺🇸United States brianperry

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Pipeline finished with Skipped
    over 1 year ago
    #12371
  • Pipeline finished with Skipped
    over 1 year ago
    #12726
  • Pipeline finished with Skipped
    over 1 year ago
    #13363
  • Pipeline finished with Skipped
    over 1 year ago
    #17126
  • Pipeline finished with Skipped
    over 1 year ago
    #17296
  • Pipeline finished with Success
    11 months ago
    Total: 200s
    #86213
  • Pipeline finished with Failed
    11 months ago
    Total: 219s
    #86231
  • Pipeline finished with Failed
    11 months ago
    Total: 163s
    #86233
  • Pipeline finished with Failed
    11 months ago
    #86278
  • Pipeline finished with Canceled
    11 months ago
    Total: 30s
    #86284
  • Pipeline finished with Failed
    11 months ago
    Total: 296s
    #86286
  • Pipeline finished with Failed
    11 months ago
    #86294
  • Pipeline finished with Failed
    11 months ago
    Total: 361s
    #86306
  • Pipeline finished with Failed
    11 months ago
    Total: 271s
    #86320
  • Pipeline finished with Failed
    11 months ago
    Total: 169s
    #86489
  • Pipeline finished with Failed
    11 months ago
    Total: 183s
    #86846
  • Issue created by @brianperry
  • Assigned to pratik_kamble
  • Pipeline finished with Success
    11 months ago
    Total: 149s
    #92401
  • Issue was unassigned.
  • Status changed to Needs review 11 months ago
  • Status changed to Needs work 11 months ago
  • Status changed to Needs review 11 months ago
  • Pipeline finished with Success
    11 months ago
    Total: 152s
    #92755
  • Pipeline finished with Failed
    11 months ago
    Total: 230s
    #95100
  • Pipeline finished with Success
    11 months ago
    Total: 194s
    #95208
  • Pipeline finished with Success
    11 months ago
    Total: 213s
    #95217
  • Pipeline finished with Success
    11 months ago
    Total: 198s
    #95233
  • Pipeline finished with Success
    11 months ago
    Total: 166s
    #95248
  • Pipeline finished with Success
    11 months ago
    Total: 198s
    #95251
  • Pipeline finished with Failed
    11 months ago
    Total: 163s
    #95266
  • Status changed to Needs work 11 months ago
  • 🇺🇸United States brianperry

    Setting this to 'needs work' based on the assumption that we are going to apply similar changes to the delete method. What is there so far is looking great though.

  • Assigned to pratik_kamble
  • Status changed to Active 11 months ago
  • Issue was unassigned.
  • Status changed to Needs review 11 months ago
  • Pipeline finished with Success
    11 months ago
    Total: 215s
    #96987
  • Pipeline finished with Success
    11 months ago
    Total: 213s
    #96992
  • Status changed to RTBC 11 months ago
  • Status changed to Fixed 10 months ago
  • Pipeline finished with Failed
    10 months ago
    Total: 144s
    #97584
  • Pipeline finished with Success
    10 months ago
    Total: 174s
    #97594
  • Pipeline finished with Success
    10 months ago
    Total: 145s
    #97606
  • Pipeline finished with Success
    10 months ago
    #97667
  • Pipeline finished with Success
    10 months ago
    Total: 149s
    #97708
  • Pipeline finished with Failed
    10 months ago
    Total: 359s
    #98706
  • Pipeline finished with Failed
    10 months ago
    Total: 356s
    #98726
  • Pipeline finished with Failed
    10 months ago
    Total: 330s
    #98782
  • Pipeline finished with Skipped
    10 months ago
    #99690
  • Pipeline finished with Canceled
    10 months ago
    #103443
  • Pipeline finished with Success
    10 months ago
    #103447
  • Pipeline finished with Canceled
    10 months ago
    #103449
  • Pipeline finished with Canceled
    10 months ago
    #103450
  • Pipeline finished with Success
    10 months ago
    #103451
  • Pipeline finished with Success
    10 months ago
    #103457
  • Automatically closed - issue fixed for 2 weeks with no activity.

  • Pipeline finished with Failed
    10 months ago
    Total: 179s
    #116795
  • Pipeline finished with Success
    10 months ago
    Total: 146s
    #116805
Production build 0.71.5 2024