Page MenuHomePhabricator

Setup edit API calls to test-commons
Closed, ResolvedPublicFeature

Description

Now that the client is posting the full edit api call options with each contribution, it must be signed with the user access token and secret keys before being posted on to https://test-commons.wikimedia.org/w/api.php

The API options for each individual contribution can be found in the api_options key, e.g. api_options = contribution["api_options"]

This task covers steps 2,3 and 6 in the diagram below.
Note: Steps 1, 4 and 5 are already complete. Howeve

Edit API call flow

All edit API calls are made one contribution at a time and completely serially. In other words, each next API call needs to wait until the previous one has returned it's response.

For the first contribution in the array provided by the client in step 1, the baserevid is already included in the api_options.

For all subsequent contributions, the baserevid will need to be added to the api_options using the response from the previous contribution. So the steps are as follows:

For each contribution in the array :

  • Get the edit api options from contribution["api_options"]
  • Add OAuth tokens/secrets to the same api_options object
  • ( Add baserevid to api_options, using value saved from the previous edit response. This is NOT needed for the FIRST contribution, as it's provided by the client )
  • Post using the final signed api_options to https://test-commons.wikimedia.org/w/api.php
  • If edit successful:
    • store the new "baserevid" from the response (this will be needed for the next contribution posted)
    • Commit contribution to the database
  • Repeat for next contribution...

Finally send the response to the client's initial contributions post request in STEP 1 from the diagram.
This must be done only once ALL responses have been received from contributions posted to to Commons, and they have been commited to the database

Event Timeline

This comment was removed by NavinoEvans.
NavinoEvans updated the task description. (Show Details)Jun 19 2019, 11:00 AM
NavinoEvans triaged this task as High priority.Jun 19 2019, 11:16 AM
NavinoEvans updated the task description. (Show Details)
NavinoEvans updated the task description. (Show Details)Jul 8 2019, 10:36 PM
NavinoEvans updated the task description. (Show Details)
NavinoEvans updated the task description. (Show Details)
NavinoEvans updated the task description. (Show Details)Jul 8 2019, 10:38 PM
NavinoEvans updated the task description. (Show Details)
NavinoEvans updated the task description. (Show Details)
NavinoEvans updated the task description. (Show Details)Jul 9 2019, 12:56 PM
NavinoEvans updated the task description. (Show Details)Jul 9 2019, 1:25 PM
NavinoEvans updated the task description. (Show Details)Jul 9 2019, 2:27 PM
NavinoEvans updated the task description. (Show Details)Jul 9 2019, 3:10 PM
NavinoEvans changed the subtype of this task from "Task" to "Feature Request".Jul 9 2019, 3:13 PM
NavinoEvans updated the task description. (Show Details)Jul 16 2019, 11:45 PM
NavinoEvans updated the task description. (Show Details)Jul 21 2019, 12:17 PM
NavinoEvans updated the task description. (Show Details)
NavinoEvans renamed this task from Setup edit API calls to test Commons to Setup edit API calls to test-commons.Jul 22 2019, 9:09 AM
NavinoEvans assigned this task to Eugene233.
Eugene233 moved this task from Pending to In progress on the ISA board.Jul 28 2019, 6:48 PM

Change 526003 had a related patch set uploaded (by Eugene233; owner: Eugene233):
[labs/tools/Isa@master] Setup edit API calls to test-commons

https://gerrit.wikimedia.org/r/526003

NavinoEvans moved this task from In progress to Review on the ISA board.Jul 28 2019, 11:22 PM

Change 526003 abandoned by Eugene233:
Setup edit API calls to test-commons

https://gerrit.wikimedia.org/r/526003

Change 526102 had a related patch set uploaded (by Eugene233; owner: Eugene233):
[labs/tools/Isa@master] Setup edit API calls to test-commons

https://gerrit.wikimedia.org/r/526102

Change 526102 merged by jenkins-bot:
[labs/tools/Isa@master] Setup edit API calls to test-commons

https://gerrit.wikimedia.org/r/526102

NavinoEvans closed this task as Resolved.Sep 9 2019, 12:28 PM