Showing Posts For pruocco.5368:

guild/:id does not match its example

in API Development

Posted by: pruocco.5368

pruocco.5368

https://wiki.guildwars2.com/wiki/API:2/guild/:id

The example at the bottom does not match what the API actual provides you. Is this a mistake, or a preview of whats to come? I am looking to retrieve the level, motd, influence, favor, aetherium, and resonance in particular.

Thanks

How can I cross reference two API's? PHP

in API Development

Posted by: pruocco.5368

pruocco.5368

Thanks for the reply Anhim, but I don’t think that’s what I’m looking for. I have the data for our guild treasury shown in a table, but I am trying to show the names of the treasury items in the results. The guild treasury API does not have the items names, just their ID. https://wiki.guildwars2.com/wiki/API:2/guild/:id/treasury

Attachments:

(edited by pruocco.5368)

How can I cross reference two API's? PHP

in API Development

Posted by: pruocco.5368

pruocco.5368

I am new to using the GW2 API (or any API for that matter) and I’m starting to get the hang of it. I was able to teach myself how to get basic information using the API and PHP to decode the .json files. I’ve created a table showing our guild’s treasury which looks like the following:


Item       |   Quantity   |   Upgrade (Quantity Needed)
-----------------------------------------------------------------
12134     |   100             |   641 (1000)
12135     |   500             |   365 (750)

.
In it’s simplest form, it only shows the ID numbers for the items and upgrades. This is where I am wondering how to cross reference this data with the data from the items API to display the item names.

Does anybody have any instruction on how to do this?


                            $treasury = file_get_contents('https://api.guildwars2.com/v2/guild/B95A3B40-A764-4648-8EE6-39549E922A99/treasury?access_token=358AC6CB-0596-D64F-88D5-5CFA9AA27AAA273F3C6A-BC9E-47EE-AA28-63565C3EFEEE');
                            $treasury = json_decode($treasury);
                        
                            foreach($treasury as $key => $treasury) {
                                
                                echo '<tr>';
                                echo '<td>'.$treasury -> item_id.'</td>';
                                echo '<td>'.$treasury -> count.'</td>';
                                echo '<td>';
                                    foreach($treasury -> needed_by as $key => $treasury) {
                                        echo $treasury -> upgrade_id.' ('.$treasury -> count.')<br />';
                                    }
                                echo '</td>';
                                
                            }
                            echo '</table>';

(edited by pruocco.5368)