Coder Social home page Coder Social logo

OpenBazaar API return empty price about openbazaar-go HOT 5 CLOSED

 avatar commented on June 9, 2024
OpenBazaar API return empty price

from openbazaar-go.

Comments (5)

hoffmabc avatar hoffmabc commented on June 9, 2024

What API call are you making?

from openbazaar-go.

 avatar commented on June 9, 2024

https://api.docs.openbazaar.org

I use openbazaar-go v0.14.1 to collect search index. For example, some listings without price presented in this search result also have empty price value through direct API call, but Client v2.4.3 works fine, how is it possible.

from openbazaar-go.

hoffmabc avatar hoffmabc commented on June 9, 2024

From 0.14.0 and up the pricing values have changed a bit to support ETH style currencies and different divisibilities of currencies. We need to update the API docs.

When scraping listings indexes you will now see this for price:

"price": {
            "amount": "20",
            "currency": {
                "code": "USD",
                "currencyType": "fiat",
                "divisibility": 2,
                "name": "United States Dollar"
            }
        },

When scraping an individual listing you will see this:

"item": {
            "title": "Casio F91W-1 Classic Resin Strap Digital Sport Watch",
            "description": "<p>A tried and true style great for casual wear. With its daily alarm, hourly time signal and auto calendar, you&#39;ll never need to worry about missing an appointment again. Black Casual Classic watch with a Resin Band. Accuracy: ± 30 Seconds a month                </p>",
            "processingTime": "",
            "price": 0,
            "nsfw": false,
            "tags": [
                "Clothing, Shoes &amp; Jewelry",
                "Men",
                "Watches",
                "Wrist Watches"
            ],
            "images": [
                {
                    "filename": "1588451376538",
                    "original": "QmNr9QHTK5A39V3xjnKAsK8MwwMSwW8FMCRSu65sJVbPFY",
                    "large": "QmZWppsF2ez7FuHmqJJmtqWvt7CLmDeNYF2M4AMhujNeya",
                    "medium": "QmXRYJpQBcV5iwpvuw5WfALr3YcruKRjGFudqAXT8AE7gT",
                    "small": "QmdsT79FYUZV2L7hYHajHETPPzwG3wmE6Dv3GVUyM4rSG1",
                    "tiny": "QmfPmEEMH4EDakV8m1tuLdzUr3SQfp9xxppxW34fsFrR9h"
                }
            ],
            "categories": [
                "Clothing, Shoes &amp; Jewelry"
            ],
            "grams": 0,
            "condition": "",
            "options": [
            ],
            "skus": [
                {
                    "productID": "",
                    "surcharge": 0,
                    "quantity": 0,
                    "bigSurcharge": "0",
                    "bigQuantity": "-1"
                }
            ],
            "priceModifier": 0,
            "bigPrice": "1069",
            "priceCurrency": {
                "code": "USD",
                "divisibility": 2
            }
        },

Notice how the legacy price attribute is 0 now and that bigPrice is now the value with priceCurrency describing the currency that was used to price it in.

from openbazaar-go.

 avatar commented on June 9, 2024

Thank you, it works!

from openbazaar-go.

hoffmabc avatar hoffmabc commented on June 9, 2024

Great

from openbazaar-go.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.