Skip to content

Instantly share code, notes, and snippets.

@chespinoza
Last active December 15, 2020 10:42
Show Gist options
  • Save chespinoza/586da15da4e755875af84be0bae94b8e to your computer and use it in GitHub Desktop.
Save chespinoza/586da15da4e755875af84be0bae94b8e to your computer and use it in GitHub Desktop.

GET Keyword entity

GET /amazon/sp/ad_groups/123/keywords/

{
"kind": "collection",
"self": "/amazon/sp/ad_groups/123/keywords/",
"parent": "/amazon/sp/ad_groups/123/",
"items": [
        {
            "kind": "keyword",
            "self": "/amazon/sp/ad_groups/123/keywords/11111",
            "parent": "/amazon/sp/ad_groups/123/",
            "state": "paused",
            "keyword_text": "super8",
            "match_type": "exact",
            "bid": 1.2,
        },
        {
            "kind": "keyword",
            "self": "/amazon/sp/ad_groups/123/keywords/11112",
            "parent": "/amazon/sp/ad_groups/123/",
            "state": "paused",
            "keyword_text": "super8",
            "match_type": "broad",
            "bid": 1.2,
        }
    ]
}

GET Keywords collection

GET /amazon/sp/ad_groups/123/keywords/11111

{
    "kind": "keyword",
    "self": "/amazon/sp/ad_groups/123/keywords/11111",
    "parent": "/amazon/sp/ad_groups/123/",
    "state": "paused",
    "keyword_text": "super8",
    "match_type": "exact",
    "bid": 1.2,
}

POST Keywords

POST /ad_groups/123/keywords/
[
    {
        "state": "paused",
        "keyword_text": "super8",
        "match_type": "exact",
        "bid": 1.2,      
    },
            {
        "state": "paused",
        "keyword_text": "super8",
        "match_type": "broad",
        "bid": 1.2,
    }
]

PUT Keywords

PUT /ad_groups/123/keywords/
[
    {
        "id": 11111,
        "state": "enabled",
        "bid": 1.2,
    },
    {
        "id": 11112
        "state": "enabled",
        "bid": 1.2,
    }
]
@neebone
Copy link

neebone commented Dec 14, 2020

PUT /ad_groups/123/keywords/
[
  {
    "id": 432,
    "state": "enabled",
    "bid": 1.2
  }
]

Does it not make more sense to send the id of keywords in the ad group? I don't see why we'd put the resource paths in the requests.
The parent is already implicit in the path you're posting to as well.

@chespinoza
Copy link
Author

chespinoza commented Dec 15, 2020

@neebone definitely, doing the same with POST (Removing parent reference)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment