How to query part-level SCR data in the Nexar API

Modified on Wed, 19 Jul 2023 at 04:42 PM

Part-level Supply Chain Resilience (SCR) data is available via queries in the Nexar API. The data available through these queries is the same as that available via SCR reports, but the delivery method and scale is different. SCR part-level queries are designed for small numbers of parts to be queried at once, with data returned quickly and available within the GraphQL query response. SCR reports are designed for a large number of parts to be queried simultaneously, with input data provided in a .csv file, report generation taking longer and data returned in a .csv file.


To be permitted to access SCR data, you must be signed up for an SCR Subscription and have remaining unused quota available


To receive a demo SCR Subscription or to sign up for an SCR subscription, contact us. For more information about how SCR can save your organization money, visit our web page.


SCR Subscriptions belong to Organizations and usage is metered annually on a unique part usage basis. This means that the same part can be queried multiple times within a year and it will only count as 1 unit of usage towards the quota. Both part-level SCR queries and SCR reports are metered using the same, shared SCR Subscription, so the same part queried via part-level query and via SCR report will only count as one unit of usage towards the quota.


Instructions to query per-part SCR data

The SCR query datScrPartInfos takes a list of input part ID and Estimated Annual Usage (EAU; as a number of pieces) pairs and returns data on historical and future procurability for the parts at the specified EAU values.


Note that querying for future procurability data (estimated days of supply and/or probable availability window) will noticeably increase response times. We recommend limiting the number of parts in a single query to 5 parts for optimal performance.


Data that can be returned from this query:

  • Historical Procurability (historicalProcurability) - number between 0 and 1 that indicates what proportion of the last 365 days that a part’s globally available stock was at or above the EAU value. A value of 1 indicates that a part's stock level was at least at the EAU value for every day in the past year, whereas a value of 0 indicates that a part’s stock was below the EAU value for every day in the past year.
  • Weekly Market Availability (marketAvailability) - weekly averages of the total global stock available at franchised distributors for the past 5 weeks. Due to data processing delays, the most recent date is usually about 2 days in the past.
  • Monthly Market Availability (monthlyMarketAvailability) - averages of the total global stock available at franchised distributors for the last 11 full calendar months. Due to data processing delays, the most recent date is usually about 2 days in the past.
  • Estimated Days of Supply (estimatedDaysOfSupply) - estimated number of days into the future that the total global stock for a part is predicted to remain above the EAU value, assuming the part is not restocked.
  • Probable Availability Window (probableAvailabilityWindow) - estimated number of days into the future that the total global stock for a part is predicted to remain above the EAU value, including predicted restock events.


Step 1: Get the part IDs for the parts that you would like to query SCR data for

Example query:

{
  supSearchMpn (q: "RT0402BRD072K15L"){
    hits
    results {
      part {
        id
      }
    }
  }
}

Example response:

"data": {
  "supSearchMpn": {
    "hits": 1,
    "results": [
      {
        "part": {
          "id": "1243247"
        }
      }
    ]
  }
}

See the Octopart query templates for more examples of queries that can return part IDs. The data that you need is the id field within the returned part or parts object. These queries can return multiple parts (e.g. if an MPN is a partial match for multiple parts, or is a full match for multiple parts from different manufacturers), so you should ensure that you select the correct part ID in this case.


Step 2: Query for SCR data using the part IDs obtained in Step 1

Example query:

{
  datScrPartInfos(
    parts: [
      {partId: "1243247", eau: 100000},
      {partId: "77760581", eau: 2400},
      {partId: "8315947", eau: 12000}
    ]
  ) {
    historicalProcurability
    marketAvailabilityToday
    marketAvailability7dAgo
    marketAvailability14dAgo
    marketAvailability21dAgo
    marketAvailability28dAgo
    monthlyMarketAvailability
    estimatedDaysOfSupply
    probableAvailabilityWindow
  }
}

The data is returned as a list in the same order as the list of input parts.

Example response:

"data": {
    "datScrPartInfos": [
      {
        "historicalProcurability": 0.8712328767123287,
        "marketAvailabilityToday": 156201,
        "marketAvailability7dAgo": 156201,
        "marketAvailability14dAgo": 156201,
        "marketAvailability21dAgo": 161044,
        "marketAvailability28dAgo": 191737,
        "monthlyMarketAvailability": [
          166654,
          175622,
          218796,
          174711,
          154488,
          165530,
          162451,
          235652,
          147108,
          145956,
          92503
        ],
        "estimatedDaysOfSupply": 18,
        "probableAvailabilityWindow": 33
      },
      {
        "historicalProcurability": 0.6712328767123288,
        "marketAvailabilityToday": 6048,
        "marketAvailability7dAgo": 6048,
        "marketAvailability14dAgo": 6055,
        "marketAvailability21dAgo": 7527,
        "marketAvailability28dAgo": 7966,
        "monthlyMarketAvailability": [
          6872,
          8181,
          7971,
          7039,
          7725,
          7013,
          3987,
          1946,
          1728,
          1977,
          2072
        ],
        "estimatedDaysOfSupply": 5,
        "probableAvailabilityWindow": 7
      },
      {
        "historicalProcurability": 0.915068493150685,
        "marketAvailabilityToday": 116364,
        "marketAvailability7dAgo": 116364,
        "marketAvailability14dAgo": 116364,
        "marketAvailability21dAgo": 116403,
        "marketAvailability28dAgo": 116428,
        "monthlyMarketAvailability": [
          116390,
          116993,
          113970,
          110246,
          109007,
          80548,
          20850,
          20956,
          20981,
          20529,
          16209
        ],
        "estimatedDaysOfSupply": 12,
        "probableAvailabilityWindow": 24
      }
    ]
  }


Instructions to query grouped historical procurability

There are some situations where SCR data for a set of parts might want to be considered as a group, for example when a set of parts are considered alternates to each other. There is a separate SCR query, datScrIpnPartInfo, that allows parts to be grouped together for this purpose, which will return the grouped historical procurability for the set of parts. This query takes a list of part IDs and a single Estimated Annual Usage (EAU; as a number of pieces) value as input.


The way that this works is that for any particular day, if at least one of the parts in the input group had a globally available stock level above the input EAU value, it is considered as being procurable on that day. The grouped historical procurability is then the sum of days over the last year where at least one part in the group was procurable, divided by the total number of days (365 days).


See the table below for an example of how this figure is calculated at an EAU value of 1,000. Cells highlighted in green indicate a part is considered procurable, and cells highlighted in red indicate a non-procurable part. The group historical procurability for this group of 3 parts is 0.8 over the example five-day period.


Part
Day 1
Day 2
Day 3
Day 4
Day 5
Procurability
ABC123
1,200
1,100
900
800
2,500
0.6
DEF456
1,800
1,200
700
500
100
0.4
GHJ789
1,600
500
300
2,000
600
0.6
(Maximum)
1,800
1,200
900
2,000
2,500
0.8


Data that is returned from the query:

  • Grouped Historical Procurability (ipnHistoricalProcurability) - number between 0 and 1 indicating what proportion of the past 365 days the globally available stock of at least one part in an IPN group was at or above the EAU value. A value of 1 indicates that at least one part within an IPN group had a stock level of at least its EAU value for every day in the past year, whereas a value of 0 would indicate that the stock of all parts in the IPN group was below their EAU value for every day in the past year.


Step 1: Get the part IDs for the parts that you would like to query grouped SCR data for

Example query:

{
  supMultiMatch (queries: [{mpn: "RT0402BRD072K15L"}, {mpn: "RP73PF1E2K15BTDF"}]) {
    hits
    parts {
      id
    }
  }
}

Example response:

"data": {
  "supMultiMatch": [
    {
      "hits": 1,
      "parts": [
        {
          "id": "1243247"
        }
      ]
    },
    {
      "hits": 1,
      "parts": [
        {
          "id": "89154213"
        }
      ]
    }
  ]
}

See the Octopart query templates for more examples of queries that can return part IDs. The data that you need is the id field within the returned part or parts object. These queries can return multiple parts (e.g. if an MPN is a partial match for multiple parts, or is a full match for multiple parts from different manufacturers), so you should ensure that you have selected the correct one in this case.


Step 2: Query for grouped SCR data using the part IDs obtained in Step 1

Example query input:

{
  datScrIpnPartInfo(
    partIds: ["1243247", "89154213"],
    eau: 100000
) {
    ipnHistoricalProcurability
  }
}

Example response:

"data": {
  "datScrIpnPartInfo": {
    "ipnHistoricalProcurability": 0.8712328672409058
  }
}


Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select atleast one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article