HashtagSell / posting-api

API for storage and retrieval of posting details for Hashtagsell
0 stars 0 forks source link

Publish payloads #37

Closed that1guy closed 9 years ago

that1guy commented 9 years ago

When posting item from htsApp to posting API we need to specify a few extra parameters. For example

{
    ebay_personal: {
        token: [htsApp_pass_users_ebay_token]  <---- backend pushes to personal ebay
    },
    ebay_merchant: true, <---- backend pushes to htsApp ebay acct
    amazon_personal: {
        token: [htsApp_pass_users_amazon_token] <---- backend pushes to personal Amazon
    },
    amazon_merchant: false, <---- backend pushes to htsApp Amazon acct.
    facebook: {
        publish: true,  <---- Front end publishes to user's fb timeline
        response: {
           [facebook callback data]
        }
    },
    twitter: {
        publish: true, <---- Front end publishes to user's twitter timeline
        response: {
           [twitter callback data]
        }
    }
}
that1guy commented 9 years ago

Okay, I'm all ready for this. ;) Weeee!!!

brozeph commented 9 years ago

Implemented everything but Amazon (Amazon posting may take roughly 2 days to complete - I suggest we create a new feature item in GH to track).

The behavior is as follows:

For ebay, if the following payload is submitted, the HashtagSell seller account is used (only exists to support backwards compatibility with existing front end code):

{
  "ebay": true
}

When the following payload is submitted, the supplied user seller account is used:

{
  "ebay": {
    "paypalEmail": "valid paypal email address goes here",
    "token": "really long token string goes here"
  }
}

Here's a snipped from the updated API documents for the POST to /v1/postings/:postingId/publish resource:

{
  "amazon": {
    // NOT IMPLEMENTED
  },
  "ebay": {
    "paypalEmail": "email@example.com",
    "token": "..."
  },
  "facebook": {
    // open schema
  },
  "twitter": {
    // open schema
  }
}
that1guy commented 9 years ago

This rocks! Thanks for knocking this one down josh!

On Thu, May 14, 2015 at 8:48 AM, Joshua Thomas notifications@github.com wrote:

Assigned #37 https://github.com/HashtagSell/posting-api/issues/37 to @that1guy https://github.com/that1guy.

— Reply to this email directly or view it on GitHub https://github.com/HashtagSell/posting-api/issues/37#event-304987220.

that1guy commented 9 years ago

Hrrmmm. I'm not seeing facebook or twitter data in the posting object after a successful publish.

POST to this URL

http://localhost:4043/v1/postings/8e224939915e4317919195d96b295f6a/publish

Here is my payload.

{
    "ebay":true,
    "facebook":{
        "id":"1378709109126588_1386471738350325"
    },
    "twitter":{
        "id":599033685568921600
    }
}

Here's my response which indicates the publish was a success

{
  "username": "bdavis",
  "heading": "macbook coffee table",
  "body": "I'm selling my <span class=\"mention-highlighter\" contenteditable=\"false\">#coffee table</span>&nbsp;for <span class=\"mention-highlighter-price\" contenteditable=\"false\">$300</span>&nbsp;<span class=\"mention-highlighter-location\" contenteditable=\"false\">@San Francisco, CA, United States</span>&nbsp;",
  "expiresAt": "2015-05-29T02:08:50.485Z",
  "categoryCode": "SFUR",
  "annotations": [
    {
      "key": "Year",
      "value": null
    },
    {
      "key": "Brand",
      "value": null
    }
  ],
  "postingId": "8e224939915e4317919195d96b295f6a",
  "language": "EN",
  "images": [],
  "geo": {
    "accuracy": 0,
    "location": {
      "postalCode": "94103",
      "country": "US",
      "state": "CA",
      "city": "San Francisco"
    },
    "coordinates": [
      -122.41941550000001,
      37.7749295
    ]
  },
  "createdAt": "2015-05-15T02:08:50.485Z",
  "askingPrice": {
    "value": "300",
    "currency": "USD"
  },
  "external": {
    "threeTaps": {
      "categoryGroup": "SSSS",
      "category": "SFUR",
      "location": {
        "state": "CA",
        "formatted": "San Francisco, CA, USA",
        "country": "US"
      }
    },
    "source": {
      "code": "HSHTG"
    }
  },
  "facebook": {
    "id": "1378709109126588_1386471738350325"
  },
  "twitter": {
    "id": 599033685568921600
  },
  "ebay": {
    "itemId": 110161657536,
    "url": "http://cgi.sandbox.ebay.com/ws/eBayISAPI.dll?ViewItem&item=110161657536",
    "startTime": "2015-05-15T02:08:56.629Z",
    "endTime": "2015-05-22T02:08:56.629Z",
    "paypalEmail": "admin@hashtagsell.com",
    "token": "AgAAAA**AQAAAA**aAAAAA**hmLyVA**nY+sHZ2PrBmdj6wVnY+sEZ2PrA2dj6wFk4GhDZSCqASdj6x9nY+seQ**oxgDAA**AAMAAA**N9hHa8m+zOe6j/3hM3obZpu2burAHmfX92uyE0xfkHxEZ48/CxBgz/r770My02y5TjAERwusQ92OSfOK9vWauOAqUaY0zbiRVx/UYIMiZMQTobahuoo8z7yingaGoV9h1uA3zBrI6WtHStirGs0RVZPJJtNeACxAAGtP8RIGiIloWwrqMijdAd8FA1yRbVADPsLM3FXrE06ezV+do5FT53YgHuH5kuvxpqhwq6F1xhH5Z1CsZ0oJ+fmfcdCMYmIPgSaS1dvz2V0dF/JXPYOcsvkRIoULOm7js0SXl9Y4gQKtSLL8DGFNKSysXE5EZmYlnt5r1STb1FgW55mVMZRwzQo4YpahFcCS0uVLPOc7UV5wcaCNIWJomHwMu6PFMUuAtQCl3jHYh0ldxivvVDtsQkNFk/wu7D2GgllOCoBXBzU4sRaSx4pIpNo7apaaCLY6YHYhl7qKKiv8mYNyPPNNTSrL/0ErmPramBtoLrAlNmXg0IaUHDhHaaHX1skcQkNA80Y97blozAgd2+rHhTettp9GBbJIYnZJH0H1CJtWU5Shd4Wy/SY3cTi8OPmRk+xDTCnozNhOY59Gg/MPjyWeoyXPQ5OLyI1kPy/+yt8Edt1UIvcc8EI8LqIT/GDqKkpOPDEBJtPuBHdCAUOwo7TUOz4c+IGWC6eGjH62fyoQ/Qvz36v0Cg7w2u0iHq1jSgLD/q7JDSmJnJDCNt9g3kcdahj/GaYZfQ+Ne7AdpJkNa4pkEK81zcFw4t35X0miAo2f"
  }
}

Now I lookup that exact same posting by ID and everything is missing except ebay. Facebook and twitter never stick.

{
    "_id" : ObjectId("55555532a3316dee191c273d"),
    "username" : "bdavis",
    "heading" : "macbook coffee table",
    "body" : "I'm selling my <span class=\"mention-highlighter\" contenteditable=\"false\">#coffee table</span>&nbsp;for <span class=\"mention-highlighter-price\" contenteditable=\"false\">$300</span>&nbsp;<span class=\"mention-highlighter-location\" contenteditable=\"false\">@San Francisco, CA, United States</span>&nbsp;",
    "expiresAt" : ISODate("2015-05-29T02:08:50.485Z"),
    "categoryCode" : "SFUR",
    "annotations" : [ 
        {
            "value" : null,
            "key" : "Year"
        }, 
        {
            "value" : null,
            "key" : "Brand"
        }
    ],
    "postingId" : "8e224939915e4317919195d96b295f6a",
    "language" : "EN",
    "images" : [],
    "geo" : {
        "coordinates" : [ 
            -122.4194155, 
            37.7749295
        ],
        "location" : {
            "postalCode" : "94103",
            "country" : "US",
            "state" : "CA",
            "city" : "San Francisco"
        },
        "accuracy" : 0
    },
    "createdAt" : ISODate("2015-05-15T02:08:50.485Z"),
    "askingPrice" : {
        "currency" : "USD",
        "value" : "300"
    },
    "external" : {
        "source" : {
            "code" : "HSHTG"
        },
        "threeTaps" : {
            "categoryGroup" : "SSSS",
            "category" : "SFUR",
            "location" : {
                "state" : "CA",
                "formatted" : "San Francisco, CA, USA",
                "country" : "US"
            }
        }
    },
    "ebay" : {
        "endTime" : ISODate("2015-05-22T02:08:56.629Z"),
        "itemId" : 110161657536,
        "paypalEmail" : "admin@hashtagsell.com",
        "startTime" : ISODate("2015-05-15T02:08:56.629Z"),
        "token" : "AgAAAA**AQAAAA**aAAAAA**hmLyVA**nY+sHZ2PrBmdj6wVnY+sEZ2PrA2dj6wFk4GhDZSCqASdj6x9nY+seQ**oxgDAA**AAMAAA**N9hHa8m+zOe6j/3hM3obZpu2burAHmfX92uyE0xfkHxEZ48/CxBgz/r770My02y5TjAERwusQ92OSfOK9vWauOAqUaY0zbiRVx/UYIMiZMQTobahuoo8z7yingaGoV9h1uA3zBrI6WtHStirGs0RVZPJJtNeACxAAGtP8RIGiIloWwrqMijdAd8FA1yRbVADPsLM3FXrE06ezV+do5FT53YgHuH5kuvxpqhwq6F1xhH5Z1CsZ0oJ+fmfcdCMYmIPgSaS1dvz2V0dF/JXPYOcsvkRIoULOm7js0SXl9Y4gQKtSLL8DGFNKSysXE5EZmYlnt5r1STb1FgW55mVMZRwzQo4YpahFcCS0uVLPOc7UV5wcaCNIWJomHwMu6PFMUuAtQCl3jHYh0ldxivvVDtsQkNFk/wu7D2GgllOCoBXBzU4sRaSx4pIpNo7apaaCLY6YHYhl7qKKiv8mYNyPPNNTSrL/0ErmPramBtoLrAlNmXg0IaUHDhHaaHX1skcQkNA80Y97blozAgd2+rHhTettp9GBbJIYnZJH0H1CJtWU5Shd4Wy/SY3cTi8OPmRk+xDTCnozNhOY59Gg/MPjyWeoyXPQ5OLyI1kPy/+yt8Edt1UIvcc8EI8LqIT/GDqKkpOPDEBJtPuBHdCAUOwo7TUOz4c+IGWC6eGjH62fyoQ/Qvz36v0Cg7w2u0iHq1jSgLD/q7JDSmJnJDCNt9g3kcdahj/GaYZfQ+Ne7AdpJkNa4pkEK81zcFw4t35X0miAo2f",
        "url" : "http://cgi.sandbox.ebay.com/ws/eBayISAPI.dll?ViewItem&item=110161657536"
    }
}
brozeph commented 9 years ago

twitter and Facebook payloads are treated opaquely - assumption here is that the UI performs the integration and sends those details to the API for now to track with the posting.

For Twitter and FB integration directly from the API, that will need to be developed

that1guy commented 9 years ago

I'm not understanding your answer Josh. Are you saying after I publish Facebook and Twitter payloads to a posting, that I can't query the posting API and get that data back?

brozeph commented 9 years ago

@that1guy Figured it out - I misunderstood the bug report, but found and eliminated the bug

that1guy commented 9 years ago

Sorry if my description wasn't clear. Thanks. Will test tomorrow.

that1guy commented 9 years ago

This is resolved. Thanks Josh!