Edit in GitHubLog an issue

Users

The users resource accesses and updates your user profile. You can also access your sales reports.

Profile#

You must use your mage_id for these endpoints. One way you can get your mage_id is when you obtain a session token.

Copied to your clipboard
1GET /rest/v1/users/:mage_id
2GET /rest/v1/users/:mage_id?style=summary

Get profile data#

By default, requests for profile data return all fields. You can limit the amount of data that the request returns by using the style=summary option.

The following example shows the request/response body for retrieving all profile data.

Selected FieldsTypeDescription
send_newsletterbooleanWhether to receive emails about policies and announcements
Copied to your clipboard
1curl -X GET \
2 -H 'Authorization: Bearer baGXoStRuR9VCDFQGZNzgNqbqu5WUwlr.cAxZJ9m22Le7' \
3 https://developer-stg-api.magento.com/rest/v1/users/MAG123456789

The following example shows the request/response body for retrieving a subset of profile data:

Copied to your clipboard
1curl -X GET \
2 -H 'Authorization: Bearer baGXoStRuR9VCDFQGZNzgNqbqu5WUwlr.cAxZJ9m22Le7' \
3 https://developer-stg-api.magento.com/rest/v1/users/MAG123456789?style=summary

Update profile data#

You can update most of your profile data fields, but you only need to include the fields you want to modify in the request body.

Copied to your clipboard
PUT /rest/v1/users/:mage_id

The following example shows a request to update the personal profile bio field:

Copied to your clipboard
1{
2 "action" : "submit",
3 "personal_profile" : {
4 "bio" : "My extensions have won Nobel Prizes in both literature and physics."
5 }
6}

The action field specifies which update operation to perform:

  • submit --- Once your profile is complete, publishes the profile to the Commerce Marketplace partners page.
  • draft --- The update is saved on the Marketplace Developer Portal, but not published to the Commerce Marketplace.

Request:

Copied to your clipboard
1curl -X PUT \
2 -H 'Authorization: Bearer baGXoStRuR9VCDFQGZNzgNqbqu5WUwlr.cAxZJ9m22Le7' \
3 -H 'Content-Type: application/json' \
4 -d '{ "action" : "submit", "personal_profile" : { "bio" : "My extensions have won Nobel Prizes in both literature and physics." } }' \
5 https://developer-stg-api.magento.com/rest/v1/users/MAG123456789

Response:

A 200 OK HTTP response code indicates a successful update.

Magento 2 package access keys#

Use these endpoints to manage your Magento 2 package access keys. (These keys are not your API access keys.)

Copied to your clipboard
1GET /rest/v1/users/:mage_id/keys
2POST /rest/v1/users/:mage_id/keys
3PUT /rest/v1/users/:mage_id/keys/:url_encoded_label_of_m2_key
4DELETE /rest/v1/users/:mage_id/keys/:url_encoded_label_of_m2_key

Get keys#

Use this endpoint to return the keys associated with the specified mage_id.

Copied to your clipboard
GET /rest/v1/users/:mage_id/keys

The following table lists available query parameters, all of which are optional:

ParameterTypeRequiredDescription
typestringnoType of keys requested:
m1 --- Magento 1 product keys
m2 --- Magento 2 composer repo keys
all --- Both M1 and M2 keys (default)
labelstringnoThe url encoded value of the key label; only valid for m2 type.

The following example shows the request/response body for retrieving keys without any query parameters:

Copied to your clipboard
1curl -X GET \
2 -H 'Authorization: Bearer baGXoStRuR9VCDFQGZNzgNqbqu5WUwlr.cAxZJ9m22Le7' \
3 https://developer-stg-api.magento.com/rest/v1/users/MAG123456789/keys

Magento 2 keys#

  • Each Composer key-pair has unique label and is_enabled flags to indicate whether the key is enabled.
  • A Composer key-pair is identified by user_key (username) and password_key (password) when prompted for Composer credentials.

Create keys#

Use this endpoint to create new Magento 2 Composer key-pairs. You must specify a unique label for each key. You can create multiple key-pairs in a single request.

Copied to your clipboard
POST /rest/v1/users/:mage_id/keys
Copied to your clipboard
1{
2 "m2": [
3 {
4 "label": "key_for_alice"
5 },
6 {
7 "label": "key_for_charlie"
8 }
9 ]
10}
Copied to your clipboard
1curl -X POST \
2 -H 'Authorization: Bearer baGXoStRuR9VCDFQGZNzgNqbqu5WUwlr.cAxZJ9m22Le7' \
3 -H 'Content-Type: application/json' \
4 -d '{ "m2": [ { "label" : "key_for_alice" }, { "label" : "key_for_charlie" } ] }' \
5 https://developer-stg-api.magento.com/rest/v1/users/MAG123456789/keys
  • The API returns a batch response for each label.
  • A 200 OK HTTP response code indicates a successful update.
  • Any non-200 HTTP response code indicates an error. See the message field for details.

Update keys#

Use this endpoint to enable or disable a Magento 2 Composer key-pair. You must specify the key-pair in the request using a URL-encoded string.

Copied to your clipboard
PUT /rest/v1/users/:mage_id/keys/:url_encoded_label_of_m2_key
Copied to your clipboard
1curl -X PUT \
2 -H 'Authorization: Bearer baGXoStRuR9VCDFQGZNzgNqbqu5WUwlr.cAxZJ9m22Le7' \
3 -H 'Content-Type: application/json' \
4 -d '{ "m2" : [ { "is_enabled" : true } ] }' \
5 https://developer-stg-api.magento.com/rest/v1/users/MAG123456789/keys/key_for_bob

Delete keys#

This endpoint can be used to remove a Magento 2 composer key-pair identified by the given url-encoded label.

Copied to your clipboard
DELETE /rest/v1/users/:mage_id/keys/:url_encoded_label_of_m2_key

The following curl example illustrates the call to be made:

Request:

Copied to your clipboard
1curl -X DELETE \
2 -H 'Authorization: Bearer baGXoStRuR9VCDFQGZNzgNqbqu5WUwlr.cAxZJ9m22Le7' \
3 https://developer-stg-api.magento.com/rest/v1/users/MAG123456789/keys/key_for_charlie

Response:

A 204 No Content HTTP response code indicates a successful update.

User reports#

Use these endpoints to retrieve reports owned by a specific user. Reports contain information about extension sales, payout status, aggregate sales, refund data, and more.

Copied to your clipboard
1GET /rest/v1/users/:mage_id/reports/pageviews
2GET /rest/v1/users/:mage_id/reports/totals
3GET /rest/v1/users/:mage_id/reports/sales
4GET /rest/v1/users/:mage_id/reports/refunds
  • Privacy
  • Terms of Use
  • Do not sell my personal information
  • AdChoices
Copyright © 2022 Adobe. All rights reserved.